Skip to content

Commit e51e8fb

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 202c587 commit e51e8fb

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

configure

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4775,6 +4775,48 @@ fi
47754775
if test -n "$NOT_THE_CFLAGS"; then
47764776
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
47774777
fi
4778+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
4779+
# of warnings when building plperl because of Perl. Like previously, test
4780+
# for the positive form and add the negative form
4781+
NOT_THE_CFLAGS=""
4782+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wcompound-token-split-by-macro" >&5
4783+
$as_echo_n "checking whether $CC supports -Wcompound-token-split-by-macro... " >&6; }
4784+
if ${pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro+:} false; then :
4785+
$as_echo_n "(cached) " >&6
4786+
else
4787+
pgac_save_CFLAGS=$CFLAGS
4788+
CFLAGS="$pgac_save_CFLAGS -Wcompound-token-split-by-macro"
4789+
ac_save_c_werror_flag=$ac_c_werror_flag
4790+
ac_c_werror_flag=yes
4791+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4792+
/* end confdefs.h. */
4793+
4794+
int
4795+
main ()
4796+
{
4797+
4798+
;
4799+
return 0;
4800+
}
4801+
_ACEOF
4802+
if ac_fn_c_try_compile "$LINENO"; then :
4803+
pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro=yes
4804+
else
4805+
pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro=no
4806+
fi
4807+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4808+
ac_c_werror_flag=$ac_save_c_werror_flag
4809+
CFLAGS="$pgac_save_CFLAGS"
4810+
fi
4811+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" >&5
4812+
$as_echo "$pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" >&6; }
4813+
if test x"$pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" = x"yes"; then
4814+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
4815+
fi
4816+
4817+
if test -n "$NOT_THE_CFLAGS"; then
4818+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
4819+
fi
47784820
# Similarly disable useless truncation warnings from gcc 8+
47794821
NOT_THE_CFLAGS=""
47804822
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wformat-truncation" >&5

configure.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,14 @@ if test "$GCC" = yes -a "$ICC" = no; then
453453
if test -n "$NOT_THE_CFLAGS"; then
454454
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
455455
fi
456+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
457+
# of warnings when building plperl because of Perl. Like previously, test
458+
# for the positive form and add the negative form
459+
NOT_THE_CFLAGS=""
460+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcompound-token-split-by-macro])
461+
if test -n "$NOT_THE_CFLAGS"; then
462+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
463+
fi
456464
# Similarly disable useless truncation warnings from gcc 8+
457465
NOT_THE_CFLAGS=""
458466
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wformat-truncation])

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy