Skip to content

Commit d6e789c

Browse files
bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST (GH-7395)
(cherry picked from commit e336484) Co-authored-by: INADA Naoki <[email protected]>
1 parent e135032 commit d6e789c

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
@@ -6731,9 +6731,6 @@ if test "${OPT-unset}" = "unset"
67316731
then
67326732
case $GCC in
67336733
yes)
6734-
if test "$CC" != 'g++' ; then
6735-
STRICT_PROTO="-Wstrict-prototypes"
6736-
fi
67376734
# For gcc 4.x we need to use -fwrapv so lets check if its supported
67386735
if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
67396736
WRAP="-fwrapv"
@@ -6780,8 +6777,6 @@ then
67806777
;;
67816778
esac
67826779

6783-
OPT="$OPT $STRICT_PROTO"
6784-
67856780
case $ac_sys_system in
67866781
SCO_SV*) OPT="$OPT -m486 -DSCO5"
67876782
;;
@@ -7190,6 +7185,47 @@ fi
71907185
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
71917186
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
71927187

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

configure.ac

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,9 +1458,6 @@ if test "${OPT-unset}" = "unset"
14581458
then
14591459
case $GCC in
14601460
yes)
1461-
if test "$CC" != 'g++' ; then
1462-
STRICT_PROTO="-Wstrict-prototypes"
1463-
fi
14641461
# For gcc 4.x we need to use -fwrapv so lets check if its supported
14651462
if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
14661463
WRAP="-fwrapv"
@@ -1507,8 +1504,6 @@ then
15071504
;;
15081505
esac
15091506

1510-
OPT="$OPT $STRICT_PROTO"
1511-
15121507
case $ac_sys_system in
15131508
SCO_SV*) OPT="$OPT -m486 -DSCO5"
15141509
;;
@@ -1735,6 +1730,26 @@ yes)
17351730
fi
17361731
AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
17371732

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

0 commit comments

Comments
 (0)