diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-09-11 18:56:32 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-09-11 18:56:32 (GMT) |
commit | ea80ffb8513d71e8addaeab5d6359daae271225d (patch) | |
tree | 2a7b378144da07610d84c03fd5aa93788f86efdd | |
parent | 81b08a8217d656e874ef82974fc1a7a8eb9fd291 (diff) | |
download | cpython-ea80ffb8513d71e8addaeab5d6359daae271225d.zip cpython-ea80ffb8513d71e8addaeab5d6359daae271225d.tar.gz cpython-ea80ffb8513d71e8addaeab5d6359daae271225d.tar.bz2 |
Issue #23545: Turn on extra warnings on GCC.
-rwxr-xr-x | configure | 124 | ||||
-rw-r--r-- | configure.ac | 61 |
2 files changed, 185 insertions, 0 deletions
@@ -6920,6 +6920,47 @@ case $GCC in yes) CFLAGS_NODIST="$CFLAGS_NODIST -std=c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5 +$as_echo_n "checking for -Wextra... " >&6; } + ac_save_cc="$CC" + CC="$CC -Wextra -Werror" + if ${ac_cv_extra_warnings+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_extra_warnings=yes + +else + + ac_cv_extra_warnings=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + CC="$ac_save_cc" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_extra_warnings" >&5 +$as_echo "$ac_cv_extra_warnings" >&6; } + + if test $ac_cv_extra_warnings = yes + then + CFLAGS_NODIST="$CFLAGS_NODIST -Wextra" + fi + # Python doesn't violate C99 aliasing rules, but older versions of # GCC produce warnings for legal Python code. Enable # -fno-strict-aliasing on versions of GCC that support but produce @@ -7040,6 +7081,89 @@ $as_echo "$ac_cv_disable_unused_result_warning" >&6; } if test $ac_cv_disable_unused_result_warning = yes then BASECFLAGS="$BASECFLAGS -Wno-unused-result" + CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-result" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn off $CC unused parameter warning" >&5 +$as_echo_n "checking if we can turn off $CC unused parameter warning... " >&6; } + ac_save_cc="$CC" + CC="$CC -Wunused-parameter -Werror" + if ${ac_cv_disable_unused_parameter_warning+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_disable_unused_parameter_warning=yes + +else + + ac_cv_disable_unused_parameter_warning=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + CC="$ac_save_cc" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_disable_unused_parameter_warning" >&5 +$as_echo "$ac_cv_disable_unused_parameter_warning" >&6; } + + if test $ac_cv_disable_unused_parameter_warning = yes + then + CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn off $CC missing field initializers warning" >&5 +$as_echo_n "checking if we can turn off $CC missing field initializers warning... " >&6; } + ac_save_cc="$CC" + CC="$CC -Wmissing-field-initializers -Werror" + if ${ac_cv_disable_missing_field_initializers+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_disable_missing_field_initializers=yes + +else + + ac_cv_disable_missing_field_initializers=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + CC="$ac_save_cc" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_disable_missing_field_initializers" >&5 +$as_echo "$ac_cv_disable_missing_field_initializers" >&6; } + + if test $ac_cv_disable_missing_field_initializers = yes + then + CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn on $CC mixed sign comparison warning" >&5 diff --git a/configure.ac b/configure.ac index 328c610..0eaa06c 100644 --- a/configure.ac +++ b/configure.ac @@ -1517,6 +1517,26 @@ case $GCC in yes) CFLAGS_NODIST="$CFLAGS_NODIST -std=c99" + AC_MSG_CHECKING(for -Wextra) + ac_save_cc="$CC" + CC="$CC -Wextra -Werror" + AC_CACHE_VAL(ac_cv_extra_warnings, + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM([[]], [[]]) + ],[ + ac_cv_extra_warnings=yes + ],[ + ac_cv_extra_warnings=no + ])) + CC="$ac_save_cc" + AC_MSG_RESULT($ac_cv_extra_warnings) + + if test $ac_cv_extra_warnings = yes + then + CFLAGS_NODIST="$CFLAGS_NODIST -Wextra" + fi + # Python doesn't violate C99 aliasing rules, but older versions of # GCC produce warnings for legal Python code. Enable # -fno-strict-aliasing on versions of GCC that support but produce @@ -1581,6 +1601,47 @@ yes) if test $ac_cv_disable_unused_result_warning = yes then BASECFLAGS="$BASECFLAGS -Wno-unused-result" + CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-result" + fi + + AC_MSG_CHECKING(if we can turn off $CC unused parameter warning) + ac_save_cc="$CC" + CC="$CC -Wunused-parameter -Werror" + AC_CACHE_VAL(ac_cv_disable_unused_parameter_warning, + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM([[]], [[]]) + ],[ + ac_cv_disable_unused_parameter_warning=yes + ],[ + ac_cv_disable_unused_parameter_warning=no + ])) + CC="$ac_save_cc" + AC_MSG_RESULT($ac_cv_disable_unused_parameter_warning) + + if test $ac_cv_disable_unused_parameter_warning = yes + then + CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter" + fi + + AC_MSG_CHECKING(if we can turn off $CC missing field initializers warning) + ac_save_cc="$CC" + CC="$CC -Wmissing-field-initializers -Werror" + AC_CACHE_VAL(ac_cv_disable_missing_field_initializers, + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM([[]], [[]]) + ],[ + ac_cv_disable_missing_field_initializers=yes + ],[ + ac_cv_disable_missing_field_initializers=no + ])) + CC="$ac_save_cc" + AC_MSG_RESULT($ac_cv_disable_missing_field_initializers) + + if test $ac_cv_disable_missing_field_initializers = yes + then + CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers" fi AC_MSG_CHECKING(if we can turn on $CC mixed sign comparison warning) |