Skip to content

Commit 8972a15

Browse files
committed
Suppress clang's unhelpful gripes about -pthread switch being unused.
Considering the number of cases in which "unused" command line arguments are silently ignored by compilers, it's fairly astonishing that anybody thought this warning was useful; it's certainly nothing but an annoyance when building Postgres. One such case is that neither gcc nor clang complain about unrecognized -Wno-foo switches, making it more difficult to figure out whether the switch does anything than one could wish. Back-patch to 9.3, which is as far back as the patch applies conveniently (we'd have to back-patch PGAC_PROG_CC_VAR_OPT to go further, and it doesn't seem worth that).
1 parent 1d71d36 commit 8972a15

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

configure

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4694,6 +4694,47 @@ if test x"$pgac_cv_prog_cc_cflags__ftree_vectorize" = x"yes"; then
46944694
CFLAGS_VECTOR="${CFLAGS_VECTOR} -ftree-vectorize"
46954695
fi
46964696

4697+
# We want to suppress clang's unhelpful unused-command-line-argument warnings
4698+
# but gcc won't complain about unrecognized -Wno-foo switches, so we have to
4699+
# test for the positive form and if that works, add the negative form
4700+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wunused-command-line-argument" >&5
4701+
$as_echo_n "checking whether $CC supports -Wunused-command-line-argument... " >&6; }
4702+
if ${pgac_cv_prog_cc_cflags__Wunused_command_line_argument+:} false; then :
4703+
$as_echo_n "(cached) " >&6
4704+
else
4705+
pgac_save_CFLAGS=$CFLAGS
4706+
CFLAGS="$pgac_save_CFLAGS -Wunused-command-line-argument"
4707+
ac_save_c_werror_flag=$ac_c_werror_flag
4708+
ac_c_werror_flag=yes
4709+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4710+
/* end confdefs.h. */
4711+
4712+
int
4713+
main ()
4714+
{
4715+
4716+
;
4717+
return 0;
4718+
}
4719+
_ACEOF
4720+
if ac_fn_c_try_compile "$LINENO"; then :
4721+
pgac_cv_prog_cc_cflags__Wunused_command_line_argument=yes
4722+
else
4723+
pgac_cv_prog_cc_cflags__Wunused_command_line_argument=no
4724+
fi
4725+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4726+
ac_c_werror_flag=$ac_save_c_werror_flag
4727+
CFLAGS="$pgac_save_CFLAGS"
4728+
fi
4729+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wunused_command_line_argument" >&5
4730+
$as_echo "$pgac_cv_prog_cc_cflags__Wunused_command_line_argument" >&6; }
4731+
if test x"$pgac_cv_prog_cc_cflags__Wunused_command_line_argument" = x"yes"; then
4732+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
4733+
fi
4734+
4735+
if test -n "$NOT_THE_CFLAGS"; then
4736+
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
4737+
fi
46974738
elif test "$ICC" = yes; then
46984739
# Intel's compiler has a bug/misoptimization in checking for
46994740
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

configure.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,13 @@ if test "$GCC" = yes -a "$ICC" = no; then
440440
# Optimization flags for specific files that benefit from vectorization
441441
PGAC_PROG_CC_VAR_OPT(CFLAGS_VECTOR, [-funroll-loops])
442442
PGAC_PROG_CC_VAR_OPT(CFLAGS_VECTOR, [-ftree-vectorize])
443+
# We want to suppress clang's unhelpful unused-command-line-argument warnings
444+
# but gcc won't complain about unrecognized -Wno-foo switches, so we have to
445+
# test for the positive form and if that works, add the negative form
446+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wunused-command-line-argument])
447+
if test -n "$NOT_THE_CFLAGS"; then
448+
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
449+
fi
443450
elif test "$ICC" = yes; then
444451
# Intel's compiler has a bug/misoptimization in checking for
445452
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

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