Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73b416b

Browse files
committed
Suppress clang's unhelpful gripes about -pthread switch being unused.
Considering the number of cases in which "unused" command line argumentsare silently ignored by compilers, it's fairly astonishing that anybodythought this warning was useful; it's certainly nothing but an annoyancewhen building Postgres. One such case is that neither gcc nor clangcomplain about unrecognized -Wno-foo switches, making it more difficultto 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'tseem worth that).
1 parente8fde1f commit73b416b

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
@@ -4723,6 +4723,47 @@ if test x"$pgac_cv_prog_cc_cflags__ftree_vectorize" = x"yes"; then
47234723
CFLAGS_VECTOR="${CFLAGS_VECTOR} -ftree-vectorize"
47244724
fi
47254725

4726+
# We want to suppress clang's unhelpful unused-command-line-argument warnings
4727+
# but gcc won't complain about unrecognized -Wno-foo switches, so we have to
4728+
# test for the positive form and if that works, add the negative form
4729+
{$as_echo"$as_me:${as_lineno-$LINENO}: checking whether$CC supports -Wunused-command-line-argument">&5
4730+
$as_echo_n"checking whether$CC supports -Wunused-command-line-argument...">&6; }
4731+
if${pgac_cv_prog_cc_cflags__Wunused_command_line_argument+:}false;then:
4732+
$as_echo_n"(cached)">&6
4733+
else
4734+
pgac_save_CFLAGS=$CFLAGS
4735+
CFLAGS="$pgac_save_CFLAGS -Wunused-command-line-argument"
4736+
ac_save_c_werror_flag=$ac_c_werror_flag
4737+
ac_c_werror_flag=yes
4738+
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
4739+
/* end confdefs.h. */
4740+
4741+
int
4742+
main ()
4743+
{
4744+
4745+
;
4746+
return 0;
4747+
}
4748+
_ACEOF
4749+
if ac_fn_c_try_compile"$LINENO";then:
4750+
pgac_cv_prog_cc_cflags__Wunused_command_line_argument=yes
4751+
else
4752+
pgac_cv_prog_cc_cflags__Wunused_command_line_argument=no
4753+
fi
4754+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4755+
ac_c_werror_flag=$ac_save_c_werror_flag
4756+
CFLAGS="$pgac_save_CFLAGS"
4757+
fi
4758+
{$as_echo"$as_me:${as_lineno-$LINENO}: result:$pgac_cv_prog_cc_cflags__Wunused_command_line_argument">&5
4759+
$as_echo"$pgac_cv_prog_cc_cflags__Wunused_command_line_argument">&6; }
4760+
iftest x"$pgac_cv_prog_cc_cflags__Wunused_command_line_argument" = x"yes";then
4761+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
4762+
fi
4763+
4764+
iftest -n"$NOT_THE_CFLAGS";then
4765+
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
4766+
fi
47264767
eliftest"$ICC" = yes;then
47274768
# Intel's compiler has a bug/misoptimization in checking for
47284769
# 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
@@ -445,6 +445,13 @@ if test "$GCC" = yes -a "$ICC" = no; then
445445
# Optimization flags for specific files that benefit from vectorization
446446
PGAC_PROG_CC_VAR_OPT(CFLAGS_VECTOR, [-funroll-loops])
447447
PGAC_PROG_CC_VAR_OPT(CFLAGS_VECTOR, [-ftree-vectorize])
448+
# We want to suppress clang's unhelpful unused-command-line-argument warnings
449+
# but gcc won't complain about unrecognized -Wno-foo switches, so we have to
450+
# test for the positive form and if that works, add the negative form
451+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wunused-command-line-argument])
452+
if test -n "$NOT_THE_CFLAGS"; then
453+
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
454+
fi
448455
elif test "$ICC" = yes; then
449456
# Intel's compiler has a bug/misoptimization in checking for
450457
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp