From fd5248ca63ce3cf35f22cebd2088c4dfd3d994a4 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 03/23] Add test for -Wmissing-prototypes This was part of the hard-coded default warnings set in C, but the option is not valid for C++ (since prototypes are always required). --- configure | 38 +++++++++++++++++++++++++++++++++++++- configure.in | 4 +++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/configure b/configure index b1ad1ce838..f0c5356e1f 100755 --- a/configure +++ b/configure @@ -4440,7 +4440,43 @@ fi # but has its own. Also check other compiler-specific flags here. if test "$GCC" = yes -a "$ICC" = no; then - CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith" + CFLAGS="-Wall -Wpointer-arith" + # not valid for C++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wmissing-prototypes" >&5 +$as_echo_n "checking whether $CC supports -Wmissing-prototypes... " >&6; } +if ${pgac_cv_prog_cc_cflags__Wmissing_prototypes+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=$CFLAGS +CFLAGS="$pgac_save_CFLAGS -Wmissing-prototypes" +ac_save_c_werror_flag=$ac_c_werror_flag +ac_c_werror_flag=yes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pgac_cv_prog_cc_cflags__Wmissing_prototypes=yes +else + pgac_cv_prog_cc_cflags__Wmissing_prototypes=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=$ac_save_c_werror_flag +CFLAGS="$pgac_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wmissing_prototypes" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__Wmissing_prototypes" >&6; } +if test x"$pgac_cv_prog_cc_cflags__Wmissing_prototypes" = x"yes"; then + CFLAGS="$CFLAGS -Wmissing-prototypes" +fi + # These work in some but not all gcc versions { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wdeclaration-after-statement" >&5 $as_echo_n "checking whether $CC supports -Wdeclaration-after-statement... " >&6; } diff --git a/configure.in b/configure.in index 1d99cda1d8..8099e5c59f 100644 --- a/configure.in +++ b/configure.in @@ -445,7 +445,9 @@ fi # but has its own. Also check other compiler-specific flags here. if test "$GCC" = yes -a "$ICC" = no; then - CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith" + CFLAGS="-Wall -Wpointer-arith" + # not valid for C++ + PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes]) # These work in some but not all gcc versions PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement]) PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels]) -- 2.12.0