Skip to content

Commit e336484

Browse files
authored
bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST (GH-7395)
1 parent 5f48e26 commit e336484

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
@@ -6676,9 +6676,6 @@ if test "${OPT-unset}" = "unset"
66766676
then
66776677
case $GCC in
66786678
yes)
6679-
if test "$CC" != 'g++' ; then
6680-
STRICT_PROTO="-Wstrict-prototypes"
6681-
fi
66826679
# For gcc 4.x we need to use -fwrapv so lets check if its supported
66836680
if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
66846681
WRAP="-fwrapv"
@@ -6725,8 +6722,6 @@ then
67256722
;;
67266723
esac
67276724

6728-
OPT="$OPT $STRICT_PROTO"
6729-
67306725
case $ac_sys_system in
67316726
SCO_SV*) OPT="$OPT -m486 -DSCO5"
67326727
;;
@@ -7094,6 +7089,47 @@ fi
70947089
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
70957090
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
70967091

7092+
{ $as_echo "$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+
{ $as_echo "$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+
70977133
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can make implicit function declaration an error in $CC" >&5
70987134
$as_echo_n "checking if we can make implicit function declaration an error in $CC... " >&6; }
70997135
ac_save_cc="$CC"

configure.ac

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,9 +1421,6 @@ if test "${OPT-unset}" = "unset"
14211421
then
14221422
case $GCC in
14231423
yes)
1424-
if test "$CC" != 'g++' ; then
1425-
STRICT_PROTO="-Wstrict-prototypes"
1426-
fi
14271424
# For gcc 4.x we need to use -fwrapv so lets check if its supported
14281425
if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
14291426
WRAP="-fwrapv"
@@ -1470,8 +1467,6 @@ then
14701467
;;
14711468
esac
14721469

1473-
OPT="$OPT $STRICT_PROTO"
1474-
14751470
case $ac_sys_system in
14761471
SCO_SV*) OPT="$OPT -m486 -DSCO5"
14771472
;;
@@ -1678,6 +1673,26 @@ yes)
16781673
fi
16791674
AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
16801675

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+
16811696
AC_MSG_CHECKING(if we can make implicit function declaration an error in $CC)
16821697
ac_save_cc="$CC"
16831698
CC="$CC -Werror=implicit-function-declaration"

0 commit comments

Comments
 (0)