From 734ab587649f27dcb44458cfb43cf809ffdd9fc5 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 16 Apr 2020 12:40:53 -0400 Subject: Use -Wshadow=local if supported --- configure | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 13 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 9703878f..d6aebce8 100755 --- a/configure +++ b/configure @@ -785,7 +785,6 @@ enable_largefile enable_ld_version_script with_buildrules enable_werror -enable_int_warnings enable_implicit_crypto enable_crypto_native enable_crypto_openssl @@ -1473,8 +1472,6 @@ Optional Features: --enable-ld-version-script enable linker version script (default is enabled) --enable-werror whether to treat warnings as errors (default is no) - --enable-int-warnings whether to turn on integer type warnings (default is - yes) --enable-implicit-crypto whether to enable available crypto providers that are not explicitly requested; true by default @@ -17631,26 +17628,70 @@ if test "$BUILDRULES" = "msvc"; then else try_flags="-Wconversion -Wsign-conversion" fi +oCFLAGS=$CFLAGS +CFLAGS="$CFLAGS $try_flags" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for whether to use $try_flags" >&5 $as_echo_n "checking for whether to use $try_flags... " >&6; } -# Check whether --enable-int-warnings was given. -if test "${enable_int_warnings+set}" = set; then : - enableval=$enable_int_warnings; if test "$enableval" = "yes"; then - qpdf_INT_WARNINGS=1; - else - qpdf_INT_WARNINGS=0; - fi -else +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +int a = 1; int b = a; a = b; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : qpdf_INT_WARNINGS=1 +else + qpdf_INT_WARNINGS=0 fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$qpdf_INT_WARNINGS" = "1"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - WFLAGS="$WFLAGS $try_flags" + CXXFLAGS="$CXXFLAGS $try_flags" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + CFLAGS=$oCFLAGS +fi + +if test "$BUILDRULES" != "msvc"; then + try_flags="-Wshadow=local" + oCFLAGS=$CFLAGS + CFLAGS="$CFLAGS $try_flags -Werror" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for whether to use $try_flags" >&5 +$as_echo_n "checking for whether to use $try_flags... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +int a = 1; int b = a; a = b; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + qpdf_SHADOW_WARNINGS=1 +else + qpdf_SHADOW_WARNINGS=0 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$qpdf_SHADOW_WARNINGS" = "1"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$oCFLAGS $try_flags" + CXXFLAGS="$CXXFLAGS $try_flags" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS=$oCFLAGS + fi fi -- cgit v1.2.3-70-g09d2