From 4ee9323b5680697d40e66ddbf5290af2b39f446f Mon Sep 17 00:00:00 2001 From: David Sharp Date: Mon, 13 Nov 2017 14:03:29 -0800 Subject: [PATCH] configure: Enable -Werror=uninitialized --- configure | 28 ++++++++++++++++++++++++++++ configure.in | 1 + 2 files changed, 29 insertions(+) diff --git a/configure b/configure index bd69fc8cba..58b8af9bb8 100755 --- a/configure +++ b/configure @@ -5388,6 +5388,34 @@ fi if test "$GCC" = yes -a "$ICC" = no; then CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=uninitialized" >&5 +$as_echo_n "checking if $CC supports -Werror=uninitialized... " >&6; } +pgac_save_CFLAGS=$CFLAGS +CFLAGS="$pgac_save_CFLAGS -Werror=uninitialized" +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 : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + CFLAGS="$pgac_save_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=$ac_save_c_werror_flag + # These work in some but not all gcc versions # GPDB code is full of declarations after statement. #PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement]) diff --git a/configure.in b/configure.in index e265c67d28..5fe920d313 100644 --- a/configure.in +++ b/configure.in @@ -596,6 +596,7 @@ fi if test "$GCC" = yes -a "$ICC" = no; then CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith" + PGAC_PROG_CC_CFLAGS_OPT([-Werror=uninitialized]) # These work in some but not all gcc versions # GPDB code is full of declarations after statement. #PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement]) -- GitLab