summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-02-06 13:24:00 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-02-06 13:24:00 (GMT)
commit193ee0a0e8c543f8f731f8207df21a6cc1a08591 (patch)
treeb72d97a9ccae7f2244b1737db7d5106fad8715d0 /configure.ac
parent5bad70def671612835d1fdacd83f8534920f4dcd (diff)
downloadcpython-193ee0a0e8c543f8f731f8207df21a6cc1a08591.zip
cpython-193ee0a0e8c543f8f731f8207df21a6cc1a08591.tar.gz
cpython-193ee0a0e8c543f8f731f8207df21a6cc1a08591.tar.bz2
Prohibit implicit C function declarations
Issue #27659: use -Werror=implicit-function-declaration when possible (GCC and Clang, but it depends on the compiler version). Patch written by Chi Hsuan Yen.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac20
1 files changed, 20 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 09b54a7..5610c57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1689,6 +1689,26 @@ yes)
fi
AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
+ AC_MSG_CHECKING(if we can make implicit function declaration an error in $CC)
+ ac_save_cc="$CC"
+ CC="$CC -Werror=implicit-function-declaration"
+ AC_CACHE_VAL(ac_cv_enable_implicit_function_declaration_error,
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM([[]], [[]])
+ ],[
+ ac_cv_enable_implicit_function_declaration_error=yes
+ ],[
+ ac_cv_enable_implicit_function_declaration_error=no
+ ]))
+ CC="$ac_save_cc"
+ AC_MSG_RESULT($ac_cv_enable_implicit_function_declaration_error)
+
+ if test $ac_cv_enable_implicit_function_declaration_error = yes
+ then
+ CFLAGS_NODIST="$CFLAGS_NODIST -Werror=implicit-function-declaration"
+ 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.