Skip to content

Commit d59f97c

Browse files
authored
bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST (GH-7395)
(cherry picked from commit e336484)
1 parent f74a124 commit d59f97c

File tree

3 files changed

+64
-10
lines changed

3 files changed

+64
-10
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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++.

configure

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6865,9 +6865,6 @@ if test "${OPT-unset}" = "unset"
68656865
then
68666866
case $GCC in
68676867
yes)
6868-
if test "$CC" != 'g++' ; then
6869-
STRICT_PROTO="-Wstrict-prototypes"
6870-
fi
68716868
# For gcc 4.x we need to use -fwrapv so lets check if its supported
68726869
if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
68736870
WRAP="-fwrapv"
@@ -6914,8 +6911,6 @@ then
69146911
;;
69156912
esac
69166913

6917-
OPT="$OPT $STRICT_PROTO"
6918-
69196914
case $ac_sys_system in
69206915
SCO_SV*) OPT="$OPT -m486 -DSCO5"
69216916
;;
@@ -7324,6 +7319,47 @@ fi
73247319
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
73257320
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
73267321

7322+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn on $CC strict-prototypes warning" >&5
7323+
$as_echo_n "checking if we can turn on $CC strict-prototypes warning... " >&6; }
7324+
ac_save_cc="$CC"
7325+
CC="$CC -Werror -Wstrict-prototypes"
7326+
if ${ac_cv_enable_enable_strict_prototypes_warning+:} false; then :
7327+
$as_echo_n "(cached) " >&6
7328+
else
7329+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7330+
/* end confdefs.h. */
7331+
7332+
7333+
int
7334+
main ()
7335+
{
7336+
7337+
;
7338+
return 0;
7339+
}
7340+
7341+
_ACEOF
7342+
if ac_fn_c_try_compile "$LINENO"; then :
7343+
7344+
ac_cv_enable_strict_prototypes_warning=yes
7345+
7346+
else
7347+
7348+
ac_cv_enable_strict_prototypes_warning=no
7349+
7350+
fi
7351+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7352+
fi
7353+
7354+
CC="$ac_save_cc"
7355+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_strict_prototypes_warning" >&5
7356+
$as_echo "$ac_cv_enable_strict_prototypes_warning" >&6; }
7357+
7358+
if test $ac_cv_enable_strict_prototypes_warning = yes
7359+
then
7360+
CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
7361+
fi
7362+
73277363
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
73287364
# support. Without this, treatment of subnormals doesn't follow
73297365
# the standard.

configure.ac

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,9 +1464,6 @@ if test "${OPT-unset}" = "unset"
14641464
then
14651465
case $GCC in
14661466
yes)
1467-
if test "$CC" != 'g++' ; then
1468-
STRICT_PROTO="-Wstrict-prototypes"
1469-
fi
14701467
# For gcc 4.x we need to use -fwrapv so lets check if its supported
14711468
if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
14721469
WRAP="-fwrapv"
@@ -1513,8 +1510,6 @@ then
15131510
;;
15141511
esac
15151512

1516-
OPT="$OPT $STRICT_PROTO"
1517-
15181513
case $ac_sys_system in
15191514
SCO_SV*) OPT="$OPT -m486 -DSCO5"
15201515
;;
@@ -1741,6 +1736,26 @@ yes)
17411736
fi
17421737
AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
17431738

1739+
AC_MSG_CHECKING(if we can turn on $CC strict-prototypes warning)
1740+
ac_save_cc="$CC"
1741+
CC="$CC -Werror -Wstrict-prototypes"
1742+
AC_CACHE_VAL(ac_cv_enable_enable_strict_prototypes_warning,
1743+
AC_COMPILE_IFELSE(
1744+
[
1745+
AC_LANG_PROGRAM([[]], [[]])
1746+
],[
1747+
ac_cv_enable_strict_prototypes_warning=yes
1748+
],[
1749+
ac_cv_enable_strict_prototypes_warning=no
1750+
]))
1751+
CC="$ac_save_cc"
1752+
AC_MSG_RESULT($ac_cv_enable_strict_prototypes_warning)
1753+
1754+
if test $ac_cv_enable_strict_prototypes_warning = yes
1755+
then
1756+
CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
1757+
fi
1758+
17441759
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
17451760
# support. Without this, treatment of subnormals doesn't follow
17461761
# the standard.

0 commit comments

Comments
 (0)