From d6296cf803b7774e6c7d8d3a225fde516993b2cd Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 9 Nov 2020 15:33:46 +0100 Subject: [PATCH v1 1/3] Add -Wformat-signedness --- configure | 40 ++++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + 2 files changed, 41 insertions(+) diff --git a/configure b/configure index ace4ed5dec..503f5ea14b 100755 --- a/configure +++ b/configure @@ -5738,6 +5738,46 @@ if test x"$pgac_cv_prog_CXX_cxxflags__Wcast_function_type" = x"yes"; then fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat-signedness, for CFLAGS" >&5 +$as_echo_n "checking whether ${CC} supports -Wformat-signedness, for CFLAGS... " >&6; } +if ${pgac_cv_prog_CC_cflags__Wformat_signedness+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=$CFLAGS +pgac_save_CC=$CC +CC=${CC} +CFLAGS="${CFLAGS} -Wformat-signedness" +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__Wformat_signedness=yes +else + pgac_cv_prog_CC_cflags__Wformat_signedness=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" +CC="$pgac_save_CC" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wformat_signedness" >&5 +$as_echo "$pgac_cv_prog_CC_cflags__Wformat_signedness" >&6; } +if test x"$pgac_cv_prog_CC_cflags__Wformat_signedness" = x"yes"; then + CFLAGS="${CFLAGS} -Wformat-signedness" +fi + + # This was included in -Wall/-Wformat in older GCC versions { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat-security, for CFLAGS" >&5 diff --git a/configure.ac b/configure.ac index 5b91c83fd0..ad1f2e5943 100644 --- a/configure.ac +++ b/configure.ac @@ -503,6 +503,7 @@ if test "$GCC" = yes -a "$ICC" = no; then PGAC_PROG_CXX_CFLAGS_OPT([-Wimplicit-fallthrough=3]) PGAC_PROG_CC_CFLAGS_OPT([-Wcast-function-type]) PGAC_PROG_CXX_CFLAGS_OPT([-Wcast-function-type]) + PGAC_PROG_CC_CFLAGS_OPT([-Wformat-signedness]) # This was included in -Wall/-Wformat in older GCC versions PGAC_PROG_CC_CFLAGS_OPT([-Wformat-security]) PGAC_PROG_CXX_CFLAGS_OPT([-Wformat-security]) base-commit: 8f113698b63b15a4e0a4b15d3ee37238c1d1821d -- 2.29.1