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 /configure.ac | |
parent | 81b08a8217d656e874ef82974fc1a7a8eb9fd291 (diff) | |
download | cpython-ea80ffb8513d71e8addaeab5d6359daae271225d.zip cpython-ea80ffb8513d71e8addaeab5d6359daae271225d.tar.gz cpython-ea80ffb8513d71e8addaeab5d6359daae271225d.tar.bz2 |
Issue #23545: Turn on extra warnings on GCC.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 61 |
1 files changed, 61 insertions, 0 deletions
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) |