bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST (GH-7395) · python/cpython@e336484 (original) (raw)

3 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1 +Move ``-Wstrict-prototypes`` option to ``CFLAGS_NODIST`` from ``OPT``. This
2 +option emitted annoying warnings when building extension modules written in
3 +C++.
Original file line number Diff line number Diff line change
@@ -6676,9 +6676,6 @@ if test "${OPT-unset}" = "unset"
6676 6676 then
6677 6677 case $GCC in
6678 6678 yes)
6679 -if test "$CC" != 'g++' ; then
6680 - STRICT_PROTO="-Wstrict-prototypes"
6681 -fi
6682 6679 # For gcc 4.x we need to use -fwrapv so lets check if its supported
6683 6680 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
6684 6681 WRAP="-fwrapv"
@@ -6725,8 +6722,6 @@ then
6725 6722 ;;
6726 6723 esac
6727 6724
6728 - OPT="$OPT $STRICT_PROTO"
6729 -
6730 6725 case $ac_sys_system in
6731 6726 SCO_SV*) OPT="$OPT -m486 -DSCO5"
6732 6727 ;;
@@ -7094,6 +7089,47 @@ fi
7094 7089 { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
7095 7090 asecho"as_echo "asecho"ac_cv_enable_unreachable_code_warning" >&6; }
7096 7091
7092 + { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking if we can turn on $CC strict-prototypes warning" >&5
7093 +$as_echo_n "checking if we can turn on $CC strict-prototypes warning... " >&6; }
7094 + ac_save_cc="$CC"
7095 + CC="$CC -Werror -Wstrict-prototypes"
7096 +if ${ac_cv_enable_enable_strict_prototypes_warning+:} false; then :
7097 +$as_echo_n "(cached) " >&6
7098 +else
7099 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7100 +/* end confdefs.h. */
7101 +
7102 +
7103 +int
7104 +main ()
7105 +{
7106 +
7107 + ;
7108 + return 0;
7109 +}
7110 +
7111 +_ACEOF
7112 +if ac_fn_c_try_compile "$LINENO"; then :
7113 +
7114 + ac_cv_enable_strict_prototypes_warning=yes
7115 +
7116 +else
7117 +
7118 + ac_cv_enable_strict_prototypes_warning=no
7119 +
7120 +fi
7121 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7122 +fi
7123 +
7124 + CC="$ac_save_cc"
7125 + { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_strict_prototypes_warning" >&5
7126 +$as_echo "$ac_cv_enable_strict_prototypes_warning" >&6; }
7127 +
7128 +if test $ac_cv_enable_strict_prototypes_warning = yes
7129 +then
7130 + CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
7131 +fi
7132 +
7097 7133 { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking if we can make implicit function declaration an error in $CC" >&5
7098 7134 asechon"checkingifwecanmakeimplicitfunctiondeclarationanerrorinas_echo_n "checking if we can make implicit function declaration an error in asechon"checkingifwecanmakeimplicitfunctiondeclarationanerrorinCC... " >&6; }
7099 7135 ac_save_cc="$CC"
Original file line number Diff line number Diff line change
@@ -1421,9 +1421,6 @@ if test "${OPT-unset}" = "unset"
1421 1421 then
1422 1422 case $GCC in
1423 1423 yes)
1424 - if test "$CC" != 'g++' ; then
1425 - STRICT_PROTO="-Wstrict-prototypes"
1426 - fi
1427 1424 # For gcc 4.x we need to use -fwrapv so lets check if its supported
1428 1425 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
1429 1426 WRAP="-fwrapv"
@@ -1470,8 +1467,6 @@ then
1470 1467 ;;
1471 1468 esac
1472 1469
1473 - OPT="$OPT $STRICT_PROTO"
1474 -
1475 1470 case $ac_sys_system in
1476 1471 SCO_SV*) OPT="$OPT -m486 -DSCO5"
1477 1472 ;;
@@ -1678,6 +1673,26 @@ yes)
1678 1673 fi
1679 1674 AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
1680 1675
1676 +AC_MSG_CHECKING(if we can turn on $CC strict-prototypes warning)
1677 + ac_save_cc="$CC"
1678 + CC="$CC -Werror -Wstrict-prototypes"
1679 +AC_CACHE_VAL(ac_cv_enable_enable_strict_prototypes_warning,
1680 +AC_COMPILE_IFELSE(
1681 +[
1682 + AC_LANG_PROGRAM([[]], [[]])
1683 + ],[
1684 + ac_cv_enable_strict_prototypes_warning=yes
1685 + ],[
1686 + ac_cv_enable_strict_prototypes_warning=no
1687 + ]))
1688 + CC="$ac_save_cc"
1689 +AC_MSG_RESULT($ac_cv_enable_strict_prototypes_warning)
1690 +
1691 + if test $ac_cv_enable_strict_prototypes_warning = yes
1692 + then
1693 + CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
1694 + fi
1695 +
1681 1696 AC_MSG_CHECKING(if we can make implicit function declaration an error in $CC)
1682 1697 ac_save_cc="$CC"
1683 1698 CC="$CC -Werror=implicit-function-declaration"