diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-05-20 15:22:04 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-05-20 15:22:04 (GMT) |
commit | cc00e01fadd8bcdf56ce7f6fe666cf91b97e435b (patch) | |
tree | 3ea419457ef0bfcce3ddbe01fb8c7bb7a2fd434d /configure.ac | |
parent | 63f72908a18d10a8f5786ad6929d5c770c8c0e9e (diff) | |
download | cpython-cc00e01fadd8bcdf56ce7f6fe666cf91b97e435b.zip cpython-cc00e01fadd8bcdf56ce7f6fe666cf91b97e435b.tar.gz cpython-cc00e01fadd8bcdf56ce7f6fe666cf91b97e435b.tar.bz2 |
test that the compiler support -Werror=statement-after-declaration before using it
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 647de88..c9f54dd 100644 --- a/configure.ac +++ b/configure.ac @@ -1127,8 +1127,6 @@ AC_SUBST(UNIVERSAL_ARCH_FLAGS) # tweak BASECFLAGS based on compiler and platform case $GCC in yes) - BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement" - # 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 @@ -1186,6 +1184,28 @@ yes) BASECFLAGS="$BASECFLAGS -Wno-unused-result" fi + AC_MSG_CHECKING(for -Werror=declaration-after-statement) + ac_save_cc="$CC" + CC="$CC -Werror=declaration-after-statement" + save_CFLAGS="$CFLAGS" + AC_CACHE_VAL(ac_cv_declaration_after_statement_warning, + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM([[]], [[]]) + ],[ + ac_cv_declaration_after_statement_warning=yes + ],[ + ac_cv_declaration_after_statement_warning=no + ])) + CFLAGS="$save_CFLAGS" + CC="$ac_save_cc" + AC_MSG_RESULT($ac_cv_declaration_after_statement_warning) + + if test $ac_cv_declaration_after_statement_warning = yes + then + BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement" + fi + # if using gcc on alpha, use -mieee to get (near) full IEEE 754 # support. Without this, treatment of subnormals doesn't follow # the standard. |