Skip to content

Commit 9ff47ea

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. Upstream perl has fixed this issue, but it is going to take some time before this is spread across the buildfarm, and we have noticed that some animals would be useful with an extra -Werror to help with the detection of incorrect placeholders (see b0cf544), dangomushi being one. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/YYr3qYa/R3Gw+Sbg@paquier.xyz Backpatch-through: 10
1 parent c3b3369 commit 9ff47ea

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

configure

+46
Original file line numberDiff line numberDiff line change
@@ -6334,6 +6334,52 @@ fi
63346334
if test -n "$NOT_THE_CFLAGS"; then
63356335
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
63366336
fi
6337+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
6338+
# of warnings when building plperl because of Perl. Like previously, test
6339+
# for the positive form and add the negative form
6340+
NOT_THE_CFLAGS=""
6341+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS" >&5
6342+
$as_echo_n "checking whether ${CC} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... " >&6; }
6343+
if ${pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro+:} false; then :
6344+
$as_echo_n "(cached) " >&6
6345+
else
6346+
pgac_save_CFLAGS=$CFLAGS
6347+
pgac_save_CC=$CC
6348+
CC=${CC}
6349+
CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
6350+
ac_save_c_werror_flag=$ac_c_werror_flag
6351+
ac_c_werror_flag=yes
6352+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6353+
/* end confdefs.h. */
6354+
6355+
int
6356+
main ()
6357+
{
6358+
6359+
;
6360+
return 0;
6361+
}
6362+
_ACEOF
6363+
if ac_fn_c_try_compile "$LINENO"; then :
6364+
pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro=yes
6365+
else
6366+
pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro=no
6367+
fi
6368+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6369+
ac_c_werror_flag=$ac_save_c_werror_flag
6370+
CFLAGS="$pgac_save_CFLAGS"
6371+
CC="$pgac_save_CC"
6372+
fi
6373+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro" >&5
6374+
$as_echo "$pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro" >&6; }
6375+
if test x"$pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro" = x"yes"; then
6376+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
6377+
fi
6378+
6379+
6380+
if test -n "$NOT_THE_CFLAGS"; then
6381+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
6382+
fi
63376383
# Similarly disable useless truncation warnings from gcc 8+
63386384
NOT_THE_CFLAGS=""
63396385
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat-truncation, for NOT_THE_CFLAGS" >&5

configure.ac

+8
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,14 @@ if test "$GCC" = yes -a "$ICC" = no; then
530530
if test -n "$NOT_THE_CFLAGS"; then
531531
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
532532
fi
533+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
534+
# of warnings when building plperl because of Perl. Like previously, test
535+
# for the positive form and add the negative form
536+
NOT_THE_CFLAGS=""
537+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcompound-token-split-by-macro])
538+
if test -n "$NOT_THE_CFLAGS"; then
539+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
540+
fi
533541
# Similarly disable useless truncation warnings from gcc 8+
534542
NOT_THE_CFLAGS=""
535543
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wformat-truncation])

0 commit comments

Comments
 (0)