Skip to content

Commit ebd952f

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 87671be commit ebd952f

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

configure

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4474,6 +4474,73 @@ fi
44744474
if test -n "$NOT_THE_CFLAGS"; then
44754475
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
44764476
fi
4477+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
4478+
# of warnings when building plperl because of Perl. Like previously, test
4479+
# for the positive form and add the negative form
4480+
NOT_THE_CFLAGS=""
4481+
{ $as_echo "$as_me:$LINENO: checking whether $CC supports -Wcompound-token-split-by-macro" >&5
4482+
$as_echo_n "checking whether $CC supports -Wcompound-token-split-by-macro... " >&6; }
4483+
if test "${pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro+set}" = set; then
4484+
$as_echo_n "(cached) " >&6
4485+
else
4486+
pgac_save_CFLAGS=$CFLAGS
4487+
CFLAGS="$pgac_save_CFLAGS -Wcompound-token-split-by-macro"
4488+
ac_save_c_werror_flag=$ac_c_werror_flag
4489+
ac_c_werror_flag=yes
4490+
cat >conftest.$ac_ext <<_ACEOF
4491+
/* confdefs.h. */
4492+
_ACEOF
4493+
cat confdefs.h >>conftest.$ac_ext
4494+
cat >>conftest.$ac_ext <<_ACEOF
4495+
/* end confdefs.h. */
4496+
4497+
int
4498+
main ()
4499+
{
4500+
4501+
;
4502+
return 0;
4503+
}
4504+
_ACEOF
4505+
rm -f conftest.$ac_objext
4506+
if { (ac_try="$ac_compile"
4507+
case "(($ac_try" in
4508+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4509+
*) ac_try_echo=$ac_try;;
4510+
esac
4511+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
4512+
$as_echo "$ac_try_echo") >&5
4513+
(eval "$ac_compile") 2>conftest.er1
4514+
ac_status=$?
4515+
grep -v '^ *+' conftest.er1 >conftest.err
4516+
rm -f conftest.er1
4517+
cat conftest.err >&5
4518+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
4519+
(exit $ac_status); } && {
4520+
test -z "$ac_c_werror_flag" ||
4521+
test ! -s conftest.err
4522+
} && test -s conftest.$ac_objext; then
4523+
pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro=yes
4524+
else
4525+
$as_echo "$as_me: failed program was:" >&5
4526+
sed 's/^/| /' conftest.$ac_ext >&5
4527+
4528+
pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro=no
4529+
fi
4530+
4531+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4532+
ac_c_werror_flag=$ac_save_c_werror_flag
4533+
CFLAGS="$pgac_save_CFLAGS"
4534+
fi
4535+
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" >&5
4536+
$as_echo "$pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" >&6; }
4537+
if test x"$pgac_cv_prog_cc_cflags__Wcompound_token_split_by_macro" = x"yes"; then
4538+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
4539+
fi
4540+
4541+
if test -n "$NOT_THE_CFLAGS"; then
4542+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
4543+
fi
44774544
# Similarly disable useless truncation warnings from gcc 8+
44784545
NOT_THE_CFLAGS=""
44794546
{ $as_echo "$as_me:$LINENO: checking whether $CC supports -Wformat-truncation" >&5

configure.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,14 @@ if test "$GCC" = yes -a "$ICC" = no; then
434434
if test -n "$NOT_THE_CFLAGS"; then
435435
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
436436
fi
437+
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
438+
# of warnings when building plperl because of Perl. Like previously, test
439+
# for the positive form and add the negative form
440+
NOT_THE_CFLAGS=""
441+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcompound-token-split-by-macro])
442+
if test -n "$NOT_THE_CFLAGS"; then
443+
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
444+
fi
437445
# Similarly disable useless truncation warnings from gcc 8+
438446
NOT_THE_CFLAGS=""
439447
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