Skip to content

Commit c16a781

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 a4116b8 commit c16a781

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
@@ -4790,6 +4790,48 @@ fi
47904790
if test -n "$NOT_THE_CFLAGS"; then
47914791
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
47924792
fi
4793+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
4794+
# of warnings when building plperl because of Perl. Like previously, test
4795+
# for the positive form and add the negative form
4796+
NOT_THE_CFLAGS=""
4797+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wcompound-token-split-by-macro" >&5
4798+
$as_echo_n "checking whether $CC supports -Wcompound-token-split-by-macro... " >&6; }
4799+
if ${pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro+:} false; then :
4800+
$as_echo_n "(cached) " >&6
4801+
else
4802+
pgac_save_CFLAGS=$CFLAGS
4803+
CFLAGS="$pgac_save_CFLAGS -Wcompound-token-split-by-macro"
4804+
ac_save_c_werror_flag=$ac_c_werror_flag
4805+
ac_c_werror_flag=yes
4806+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4807+
/* end confdefs.h. */
4808+
4809+
int
4810+
main ()
4811+
{
4812+
4813+
;
4814+
return 0;
4815+
}
4816+
_ACEOF
4817+
if ac_fn_c_try_compile "$LINENO"; then :
4818+
pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro=yes
4819+
else
4820+
pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro=no
4821+
fi
4822+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4823+
ac_c_werror_flag=$ac_save_c_werror_flag
4824+
CFLAGS="$pgac_save_CFLAGS"
4825+
fi
4826+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" >&5
4827+
$as_echo "$pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" >&6; }
4828+
if test x"$pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" = x"yes"; then
4829+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
4830+
fi
4831+
4832+
if test -n "$NOT_THE_CFLAGS"; then
4833+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
4834+
fi
47934835
# Similarly disable useless truncation warnings from gcc 8+
47944836
NOT_THE_CFLAGS=""
47954837
{ $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
@@ -464,6 +464,14 @@ if test "$GCC" = yes -a "$ICC" = no; then
464464
if test -n "$NOT_THE_CFLAGS"; then
465465
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
466466
fi
467+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
468+
# of warnings when building plperl because of Perl. Like previously, test
469+
# for the positive form and add the negative form
470+
NOT_THE_CFLAGS=""
471+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcompound-token-split-by-macro])
472+
if test -n "$NOT_THE_CFLAGS"; then
473+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
474+
fi
467475
# Similarly disable useless truncation warnings from gcc 8+
468476
NOT_THE_CFLAGS=""
469477
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