Skip to content

Commit 3fff9b6

Browse files
committed
Clean up compilation warnings coming from PL/Perl with clang-12~
clang-12 has introduced -Wcompound-token-split-by-macro, that is causing a large amount of warnings when building PL/Perl because of its interactions with upstream Perl. This commit adds one -Wno to CFLAGS at ./configure time if the flag is supported by the compiler to silence all those warnings. This back-patches commit 9ff47ea into out-of-support branches, pursuant to newly-established project policy. The point is to suppress scary-looking warnings so that people building these branches needn't expend brain cells verifying that it's safe to ignore the warnings. Discussion: https://postgr.es/m/d0316012-ece7-7b7e-2d36-9c38cb77cb3b@enterprisedb.com
1 parent 9ae132d commit 3fff9b6

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

configure

+42
Original file line numberDiff line numberDiff line change
@@ -4745,6 +4745,48 @@ fi
47454745
if test -n "$NOT_THE_CFLAGS"; then
47464746
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
47474747
fi
4748+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
4749+
# of warnings when building plperl because of Perl. Like previously, test
4750+
# for the positive form and add the negative form
4751+
NOT_THE_CFLAGS=""
4752+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wcompound-token-split-by-macro" >&5
4753+
$as_echo_n "checking whether $CC supports -Wcompound-token-split-by-macro... " >&6; }
4754+
if ${pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro+:} false; then :
4755+
$as_echo_n "(cached) " >&6
4756+
else
4757+
pgac_save_CFLAGS=$CFLAGS
4758+
CFLAGS="$pgac_save_CFLAGS -Wcompound-token-split-by-macro"
4759+
ac_save_c_werror_flag=$ac_c_werror_flag
4760+
ac_c_werror_flag=yes
4761+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4762+
/* end confdefs.h. */
4763+
4764+
int
4765+
main ()
4766+
{
4767+
4768+
;
4769+
return 0;
4770+
}
4771+
_ACEOF
4772+
if ac_fn_c_try_compile "$LINENO"; then :
4773+
pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro=yes
4774+
else
4775+
pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro=no
4776+
fi
4777+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4778+
ac_c_werror_flag=$ac_save_c_werror_flag
4779+
CFLAGS="$pgac_save_CFLAGS"
4780+
fi
4781+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" >&5
4782+
$as_echo "$pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" >&6; }
4783+
if test x"$pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" = x"yes"; then
4784+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
4785+
fi
4786+
4787+
if test -n "$NOT_THE_CFLAGS"; then
4788+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
4789+
fi
47484790
# Similarly disable useless truncation warnings from gcc 8+
47494791
NOT_THE_CFLAGS=""
47504792
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wformat-truncation" >&5

configure.in

+8
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,14 @@ if test "$GCC" = yes -a "$ICC" = no; then
448448
if test -n "$NOT_THE_CFLAGS"; then
449449
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
450450
fi
451+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
452+
# of warnings when building plperl because of Perl. Like previously, test
453+
# for the positive form and add the negative form
454+
NOT_THE_CFLAGS=""
455+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcompound-token-split-by-macro])
456+
if test -n "$NOT_THE_CFLAGS"; then
457+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
458+
fi
451459
# Similarly disable useless truncation warnings from gcc 8+
452460
NOT_THE_CFLAGS=""
453461
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wformat-truncation])

0 commit comments

Comments
 (0)