Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f9cc93

Browse files
committed
Issue #22110: Enable extra compilation warnings.
1 parent 30575c7 commit 7f9cc93

2 files changed

Lines changed: 134 additions & 0 deletions

File tree

configure

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6510,6 +6510,94 @@ $as_echo "$ac_cv_declaration_after_statement_warning" >&6; }
65106510
BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement"
65116511
fi
65126512

6513+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn on $CC mixed sign comparison warning" >&5
6514+
$as_echo_n "checking if we can turn on $CC mixed sign comparison warning... " >&6; }
6515+
ac_save_cc="$CC"
6516+
CC="$CC -Wsign-compare"
6517+
save_CFLAGS="$CFLAGS"
6518+
if ${ac_cv_enable_sign_compare_warning+:} false; then :
6519+
$as_echo_n "(cached) " >&6
6520+
else
6521+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6522+
/* end confdefs.h. */
6523+
6524+
6525+
int
6526+
main ()
6527+
{
6528+
6529+
;
6530+
return 0;
6531+
}
6532+
6533+
_ACEOF
6534+
if ac_fn_c_try_compile "$LINENO"; then :
6535+
6536+
ac_cv_enable_sign_compare_warning=yes
6537+
6538+
else
6539+
6540+
ac_cv_enable_sign_compare_warning=no
6541+
6542+
fi
6543+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6544+
fi
6545+
6546+
CFLAGS="$save_CFLAGS"
6547+
CC="$ac_save_cc"
6548+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_sign_compare_warning" >&5
6549+
$as_echo "$ac_cv_enable_sign_compare_warning" >&6; }
6550+
6551+
if test $ac_cv_enable_sign_compare_warning = yes
6552+
then
6553+
BASECFLAGS="$BASECFLAGS -Wsign-compare"
6554+
fi
6555+
6556+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn on $CC unreachable code warning" >&5
6557+
$as_echo_n "checking if we can turn on $CC unreachable code warning... " >&6; }
6558+
ac_save_cc="$CC"
6559+
CC="$CC -Wunreachable-code"
6560+
save_CFLAGS="$CFLAGS"
6561+
if ${ac_cv_enable_unreachable_code_warning+:} false; then :
6562+
$as_echo_n "(cached) " >&6
6563+
else
6564+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6565+
/* end confdefs.h. */
6566+
6567+
6568+
int
6569+
main ()
6570+
{
6571+
6572+
;
6573+
return 0;
6574+
}
6575+
6576+
_ACEOF
6577+
if ac_fn_c_try_compile "$LINENO"; then :
6578+
6579+
ac_cv_enable_unreachable_code_warning=yes
6580+
6581+
else
6582+
6583+
ac_cv_enable_unreachable_code_warning=no
6584+
6585+
fi
6586+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6587+
fi
6588+
6589+
CFLAGS="$save_CFLAGS"
6590+
CC="$ac_save_cc"
6591+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
6592+
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
6593+
6594+
# Don't enable unreachable code warning in debug mode, since it usually
6595+
# results in non-standard code paths.
6596+
if test $ac_cv_enable_unreachable_code_warning = yes && test "$Py_DEBUG" != "true"
6597+
then
6598+
BASECFLAGS="$BASECFLAGS -Wunreachable-code"
6599+
fi
6600+
65136601
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
65146602
# support. Without this, treatment of subnormals doesn't follow
65156603
# the standard.

configure.ac

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,52 @@ yes)
12341234
BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement"
12351235
fi
12361236

1237+
AC_MSG_CHECKING(if we can turn on $CC mixed sign comparison warning)
1238+
ac_save_cc="$CC"
1239+
CC="$CC -Wsign-compare"
1240+
save_CFLAGS="$CFLAGS"
1241+
AC_CACHE_VAL(ac_cv_enable_sign_compare_warning,
1242+
AC_COMPILE_IFELSE(
1243+
[
1244+
AC_LANG_PROGRAM([[]], [[]])
1245+
],[
1246+
ac_cv_enable_sign_compare_warning=yes
1247+
],[
1248+
ac_cv_enable_sign_compare_warning=no
1249+
]))
1250+
CFLAGS="$save_CFLAGS"
1251+
CC="$ac_save_cc"
1252+
AC_MSG_RESULT($ac_cv_enable_sign_compare_warning)
1253+
1254+
if test $ac_cv_enable_sign_compare_warning = yes
1255+
then
1256+
BASECFLAGS="$BASECFLAGS -Wsign-compare"
1257+
fi
1258+
1259+
AC_MSG_CHECKING(if we can turn on $CC unreachable code warning)
1260+
ac_save_cc="$CC"
1261+
CC="$CC -Wunreachable-code"
1262+
save_CFLAGS="$CFLAGS"
1263+
AC_CACHE_VAL(ac_cv_enable_unreachable_code_warning,
1264+
AC_COMPILE_IFELSE(
1265+
[
1266+
AC_LANG_PROGRAM([[]], [[]])
1267+
],[
1268+
ac_cv_enable_unreachable_code_warning=yes
1269+
],[
1270+
ac_cv_enable_unreachable_code_warning=no
1271+
]))
1272+
CFLAGS="$save_CFLAGS"
1273+
CC="$ac_save_cc"
1274+
AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
1275+
1276+
# Don't enable unreachable code warning in debug mode, since it usually
1277+
# results in non-standard code paths.
1278+
if test $ac_cv_enable_unreachable_code_warning = yes && test "$Py_DEBUG" != "true"
1279+
then
1280+
BASECFLAGS="$BASECFLAGS -Wunreachable-code"
1281+
fi
1282+
12371283
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
12381284
# support. Without this, treatment of subnormals doesn't follow
12391285
# the standard.

0 commit comments

Comments
 (0)