[Python-checkins] bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST (GH-7395)

INADA Naoki webhook-mailer at python.org
Wed Jun 6 01:18:20 EDT 2018


https://github.com/python/cpython/commit/d59f97c8325ba509c9b08d488091f45ca642f0b6
commit: d59f97c8325ba509c9b08d488091f45ca642f0b6
branch: 3.6
author: INADA Naoki <methane at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-06-06T14:18:14+09:00
summary:

bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST (GH-7395)

(cherry picked from commit e33648484775fa533fc8f1e5cc45f60061d29d54)

files:
A Misc/NEWS.d/next/Build/2018-06-04-21-34-34.bpo-5755.65GmCj.rst
M configure
M configure.ac

diff --git a/Misc/NEWS.d/next/Build/2018-06-04-21-34-34.bpo-5755.65GmCj.rst b/Misc/NEWS.d/next/Build/2018-06-04-21-34-34.bpo-5755.65GmCj.rst
new file mode 100644
index 000000000000..8bcad4418baf
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2018-06-04-21-34-34.bpo-5755.65GmCj.rst
@@ -0,0 +1,3 @@
+Move ``-Wstrict-prototypes`` option to ``CFLAGS_NODIST`` from ``OPT``. This
+option emitted annoying warnings when building extension modules written in
+C++.
diff --git a/configure b/configure
index f1f2daa3be99..7b7b6c82dfea 100755
--- a/configure
+++ b/configure
@@ -6865,9 +6865,6 @@ if test "${OPT-unset}" = "unset"
 then
     case $GCC in
     yes)
-        if test "$CC" != 'g++' ; then
-	    STRICT_PROTO="-Wstrict-prototypes"
-	fi
         # For gcc 4.x we need to use -fwrapv so lets check if its supported
         if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
            WRAP="-fwrapv"
@@ -6914,8 +6911,6 @@ then
 	    ;;
 	esac
 
-	OPT="$OPT $STRICT_PROTO"
-
 	case $ac_sys_system in
 	    SCO_SV*) OPT="$OPT -m486 -DSCO5"
 	    ;;
@@ -7324,6 +7319,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 turn on $CC strict-prototypes warning" >&5
+$as_echo_n "checking if we can turn on $CC strict-prototypes warning... " >&6; }
+     ac_save_cc="$CC"
+     CC="$CC -Werror -Wstrict-prototypes"
+     if ${ac_cv_enable_enable_strict_prototypes_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_enable_strict_prototypes_warning=yes
+
+else
+
+       ac_cv_enable_strict_prototypes_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_enable_strict_prototypes_warning" >&5
+$as_echo "$ac_cv_enable_strict_prototypes_warning" >&6; }
+
+    if test $ac_cv_enable_strict_prototypes_warning = yes
+    then
+      CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
+    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.
diff --git a/configure.ac b/configure.ac
index 2e6d8500831a..30d70cff2586 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1464,9 +1464,6 @@ if test "${OPT-unset}" = "unset"
 then
     case $GCC in
     yes)
-        if test "$CC" != 'g++' ; then
-	    STRICT_PROTO="-Wstrict-prototypes"
-	fi
         # For gcc 4.x we need to use -fwrapv so lets check if its supported
         if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
            WRAP="-fwrapv"
@@ -1513,8 +1510,6 @@ then
 	    ;;
 	esac
 
-	OPT="$OPT $STRICT_PROTO"
-
 	case $ac_sys_system in
 	    SCO_SV*) OPT="$OPT -m486 -DSCO5"
 	    ;;
@@ -1741,6 +1736,26 @@ yes)
     fi
     AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
 
+    AC_MSG_CHECKING(if we can turn on $CC strict-prototypes warning)
+     ac_save_cc="$CC"
+     CC="$CC -Werror -Wstrict-prototypes"
+     AC_CACHE_VAL(ac_cv_enable_enable_strict_prototypes_warning,
+       AC_COMPILE_IFELSE(
+         [
+       AC_LANG_PROGRAM([[]], [[]])
+     ],[
+       ac_cv_enable_strict_prototypes_warning=yes
+     ],[
+       ac_cv_enable_strict_prototypes_warning=no
+     ]))
+     CC="$ac_save_cc"
+    AC_MSG_RESULT($ac_cv_enable_strict_prototypes_warning)
+
+    if test $ac_cv_enable_strict_prototypes_warning = yes
+    then
+      CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
+    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.



More information about the Python-checkins mailing list