From 2d908996507eacc349d083b1f5dca1684a5c0faa Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 5 Oct 2016 12:00:00 -0400 Subject: [PATCH v2 22/23] Add additional options to silence warnings for C++ --- configure | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 4 +++ 2 files changed, 110 insertions(+) diff --git a/configure b/configure index f0c5356e1f..76e726cdbc 100755 --- a/configure +++ b/configure @@ -4441,6 +4441,112 @@ fi if test "$GCC" = yes -a "$ICC" = no; then CFLAGS="-Wall -Wpointer-arith" + # C++ support + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fpermissive" >&5 +$as_echo_n "checking whether $CC supports -fpermissive... " >&6; } +if ${pgac_cv_prog_cc_cflags__fpermissive+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=$CFLAGS +CFLAGS="$pgac_save_CFLAGS -fpermissive" +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__fpermissive=yes +else + pgac_cv_prog_cc_cflags__fpermissive=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__fpermissive" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__fpermissive" >&6; } +if test x"$pgac_cv_prog_cc_cflags__fpermissive" = x"yes"; then + CFLAGS="$CFLAGS -fpermissive" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-sign-compare" >&5 +$as_echo_n "checking whether $CC supports -Wno-sign-compare... " >&6; } +if ${pgac_cv_prog_cc_cflags__Wno_sign_compare+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=$CFLAGS +CFLAGS="$pgac_save_CFLAGS -Wno-sign-compare" +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__Wno_sign_compare=yes +else + pgac_cv_prog_cc_cflags__Wno_sign_compare=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__Wno_sign_compare" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__Wno_sign_compare" >&6; } +if test x"$pgac_cv_prog_cc_cflags__Wno_sign_compare" = x"yes"; then + CFLAGS="$CFLAGS -Wno-sign-compare" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-write-strings" >&5 +$as_echo_n "checking whether $CC supports -Wno-write-strings... " >&6; } +if ${pgac_cv_prog_cc_cflags__Wno_write_strings+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=$CFLAGS +CFLAGS="$pgac_save_CFLAGS -Wno-write-strings" +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__Wno_write_strings=yes +else + pgac_cv_prog_cc_cflags__Wno_write_strings=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__Wno_write_strings" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__Wno_write_strings" >&6; } +if test x"$pgac_cv_prog_cc_cflags__Wno_write_strings" = x"yes"; then + CFLAGS="$CFLAGS -Wno-write-strings" +fi + # 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; } diff --git a/configure.in b/configure.in index 8099e5c59f..7a676b1bfa 100644 --- a/configure.in +++ b/configure.in @@ -446,6 +446,10 @@ fi if test "$GCC" = yes -a "$ICC" = no; then CFLAGS="-Wall -Wpointer-arith" + # C++ support + PGAC_PROG_CC_CFLAGS_OPT([-fpermissive]) + PGAC_PROG_CC_CFLAGS_OPT([-Wno-sign-compare]) + PGAC_PROG_CC_CFLAGS_OPT([-Wno-write-strings]) # not valid for C++ PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes]) # These work in some but not all gcc versions -- 2.12.0