bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST (GH-7395) · python/cpython@d6e789c (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
@@ -6731,9 +6731,6 @@ if test "${OPT-unset}" = "unset"
6731 6731 then
6732 6732 case $GCC in
6733 6733 yes)
6734 -if test "$CC" != 'g++' ; then
6735 - STRICT_PROTO="-Wstrict-prototypes"
6736 -fi
6737 6734 # For gcc 4.x we need to use -fwrapv so lets check if its supported
6738 6735 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
6739 6736 WRAP="-fwrapv"
@@ -6780,8 +6777,6 @@ then
6780 6777 ;;
6781 6778 esac
6782 6779
6783 - OPT="$OPT $STRICT_PROTO"
6784 -
6785 6780 case $ac_sys_system in
6786 6781 SCO_SV*) OPT="$OPT -m486 -DSCO5"
6787 6782 ;;
@@ -7190,6 +7185,47 @@ fi
7190 7185 { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
7191 7186 asecho"as_echo "asecho"ac_cv_enable_unreachable_code_warning" >&6; }
7192 7187
7188 + { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking if we can turn on $CC strict-prototypes warning" >&5
7189 +$as_echo_n "checking if we can turn on $CC strict-prototypes warning... " >&6; }
7190 + ac_save_cc="$CC"
7191 + CC="$CC -Werror -Wstrict-prototypes"
7192 +if ${ac_cv_enable_enable_strict_prototypes_warning+:} false; then :
7193 +$as_echo_n "(cached) " >&6
7194 +else
7195 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7196 +/* end confdefs.h. */
7197 +
7198 +
7199 +int
7200 +main ()
7201 +{
7202 +
7203 + ;
7204 + return 0;
7205 +}
7206 +
7207 +_ACEOF
7208 +if ac_fn_c_try_compile "$LINENO"; then :
7209 +
7210 + ac_cv_enable_strict_prototypes_warning=yes
7211 +
7212 +else
7213 +
7214 + ac_cv_enable_strict_prototypes_warning=no
7215 +
7216 +fi
7217 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7218 +fi
7219 +
7220 + CC="$ac_save_cc"
7221 + { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_strict_prototypes_warning" >&5
7222 +$as_echo "$ac_cv_enable_strict_prototypes_warning" >&6; }
7223 +
7224 +if test $ac_cv_enable_strict_prototypes_warning = yes
7225 +then
7226 + CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
7227 +fi
7228 +
7193 7229 { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking if we can make implicit function declaration an error in $CC" >&5
7194 7230 asechon"checkingifwecanmakeimplicitfunctiondeclarationanerrorinas_echo_n "checking if we can make implicit function declaration an error in asechon"checkingifwecanmakeimplicitfunctiondeclarationanerrorinCC... " >&6; }
7195 7231 ac_save_cc="$CC"
Original file line number Diff line number Diff line change
@@ -1458,9 +1458,6 @@ if test "${OPT-unset}" = "unset"
1458 1458 then
1459 1459 case $GCC in
1460 1460 yes)
1461 - if test "$CC" != 'g++' ; then
1462 - STRICT_PROTO="-Wstrict-prototypes"
1463 - fi
1464 1461 # For gcc 4.x we need to use -fwrapv so lets check if its supported
1465 1462 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
1466 1463 WRAP="-fwrapv"
@@ -1507,8 +1504,6 @@ then
1507 1504 ;;
1508 1505 esac
1509 1506
1510 - OPT="$OPT $STRICT_PROTO"
1511 -
1512 1507 case $ac_sys_system in
1513 1508 SCO_SV*) OPT="$OPT -m486 -DSCO5"
1514 1509 ;;
@@ -1735,6 +1730,26 @@ yes)
1735 1730 fi
1736 1731 AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
1737 1732
1733 +AC_MSG_CHECKING(if we can turn on $CC strict-prototypes warning)
1734 + ac_save_cc="$CC"
1735 + CC="$CC -Werror -Wstrict-prototypes"
1736 +AC_CACHE_VAL(ac_cv_enable_enable_strict_prototypes_warning,
1737 +AC_COMPILE_IFELSE(
1738 +[
1739 + AC_LANG_PROGRAM([[]], [[]])
1740 + ],[
1741 + ac_cv_enable_strict_prototypes_warning=yes
1742 + ],[
1743 + ac_cv_enable_strict_prototypes_warning=no
1744 + ]))
1745 + CC="$ac_save_cc"
1746 +AC_MSG_RESULT($ac_cv_enable_strict_prototypes_warning)
1747 +
1748 + if test $ac_cv_enable_strict_prototypes_warning = yes
1749 + then
1750 + CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
1751 + fi
1752 +
1738 1753 AC_MSG_CHECKING(if we can make implicit function declaration an error in $CC)
1739 1754 ac_save_cc="$CC"
1740 1755 CC="$CC -Werror=implicit-function-declaration"