summaryrefslogtreecommitdiffstats
path: root/configure
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
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')
-rwxr-xr-xconfigure41
1 files changed, 41 insertions, 0 deletions
diff --git a/configure b/configure
index a624d1c..1126372 100755
--- a/configure
+++ b/configure
@@ -7242,6 +7242,47 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can make implicit function declaration an error in $CC" >&5
+$as_echo_n "checking if we can make implicit function declaration an error in $CC... " >&6; }
+ ac_save_cc="$CC"
+ CC="$CC -Werror=implicit-function-declaration"
+ if ${ac_cv_enable_implicit_function_declaration_error+:} 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_enable_implicit_function_declaration_error=yes
+
+else
+
+ ac_cv_enable_implicit_function_declaration_error=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_enable_implicit_function_declaration_error" >&5
+$as_echo "$ac_cv_enable_implicit_function_declaration_error" >&6; }
+
+ 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.