mirror of https://github.com/python/cpython
gh-121026: Include -Werror with new compiler flag checks to ensure compatibility (gh-121030)
This commit is contained in:
parent
0654336dd5
commit
d8f82432a3
|
@ -9609,13 +9609,13 @@ fi
|
||||||
# These flags should be enabled by default for all builds.
|
# These flags should be enabled by default for all builds.
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wimplicit-fallthrough" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wimplicit-fallthrough" >&5
|
||||||
printf %s "checking whether C compiler accepts -Wimplicit-fallthrough... " >&6; }
|
printf %s "checking whether C compiler accepts -Wimplicit-fallthrough... " >&6; }
|
||||||
if test ${ax_cv_check_cflags___Wimplicit_fallthrough+y}
|
if test ${ax_cv_check_cflags__Werror__Wimplicit_fallthrough+y}
|
||||||
then :
|
then :
|
||||||
printf %s "(cached) " >&6
|
printf %s "(cached) " >&6
|
||||||
else $as_nop
|
else $as_nop
|
||||||
|
|
||||||
ax_check_save_flags=$CFLAGS
|
ax_check_save_flags=$CFLAGS
|
||||||
CFLAGS="$CFLAGS -Wimplicit-fallthrough"
|
CFLAGS="$CFLAGS -Werror -Wimplicit-fallthrough"
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
@ -9629,16 +9629,16 @@ main (void)
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_compile "$LINENO"
|
if ac_fn_c_try_compile "$LINENO"
|
||||||
then :
|
then :
|
||||||
ax_cv_check_cflags___Wimplicit_fallthrough=yes
|
ax_cv_check_cflags__Werror__Wimplicit_fallthrough=yes
|
||||||
else $as_nop
|
else $as_nop
|
||||||
ax_cv_check_cflags___Wimplicit_fallthrough=no
|
ax_cv_check_cflags__Werror__Wimplicit_fallthrough=no
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||||
CFLAGS=$ax_check_save_flags
|
CFLAGS=$ax_check_save_flags
|
||||||
fi
|
fi
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wimplicit_fallthrough" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__Wimplicit_fallthrough" >&5
|
||||||
printf "%s\n" "$ax_cv_check_cflags___Wimplicit_fallthrough" >&6; }
|
printf "%s\n" "$ax_cv_check_cflags__Werror__Wimplicit_fallthrough" >&6; }
|
||||||
if test "x$ax_cv_check_cflags___Wimplicit_fallthrough" = xyes
|
if test "x$ax_cv_check_cflags__Werror__Wimplicit_fallthrough" = xyes
|
||||||
then :
|
then :
|
||||||
BASECFLAGS="$BASECFLAGS -Wimplicit-fallthrough"
|
BASECFLAGS="$BASECFLAGS -Wimplicit-fallthrough"
|
||||||
else $as_nop
|
else $as_nop
|
||||||
|
@ -9648,13 +9648,13 @@ fi
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-protector-strong" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-protector-strong" >&5
|
||||||
printf %s "checking whether C compiler accepts -fstack-protector-strong... " >&6; }
|
printf %s "checking whether C compiler accepts -fstack-protector-strong... " >&6; }
|
||||||
if test ${ax_cv_check_cflags___fstack_protector_strong+y}
|
if test ${ax_cv_check_cflags__Werror__fstack_protector_strong+y}
|
||||||
then :
|
then :
|
||||||
printf %s "(cached) " >&6
|
printf %s "(cached) " >&6
|
||||||
else $as_nop
|
else $as_nop
|
||||||
|
|
||||||
ax_check_save_flags=$CFLAGS
|
ax_check_save_flags=$CFLAGS
|
||||||
CFLAGS="$CFLAGS -fstack-protector-strong"
|
CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
@ -9668,16 +9668,16 @@ main (void)
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_compile "$LINENO"
|
if ac_fn_c_try_compile "$LINENO"
|
||||||
then :
|
then :
|
||||||
ax_cv_check_cflags___fstack_protector_strong=yes
|
ax_cv_check_cflags__Werror__fstack_protector_strong=yes
|
||||||
else $as_nop
|
else $as_nop
|
||||||
ax_cv_check_cflags___fstack_protector_strong=no
|
ax_cv_check_cflags__Werror__fstack_protector_strong=no
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||||
CFLAGS=$ax_check_save_flags
|
CFLAGS=$ax_check_save_flags
|
||||||
fi
|
fi
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fstack_protector_strong" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__fstack_protector_strong" >&5
|
||||||
printf "%s\n" "$ax_cv_check_cflags___fstack_protector_strong" >&6; }
|
printf "%s\n" "$ax_cv_check_cflags__Werror__fstack_protector_strong" >&6; }
|
||||||
if test "x$ax_cv_check_cflags___fstack_protector_strong" = xyes
|
if test "x$ax_cv_check_cflags__Werror__fstack_protector_strong" = xyes
|
||||||
then :
|
then :
|
||||||
BASECFLAGS="$BASECFLAGS -fstack-protector-strong"
|
BASECFLAGS="$BASECFLAGS -fstack-protector-strong"
|
||||||
else $as_nop
|
else $as_nop
|
||||||
|
@ -9685,18 +9685,15 @@ else $as_nop
|
||||||
printf "%s\n" "$as_me: WARNING: -fstack-protector-strong not supported" >&2;}
|
printf "%s\n" "$as_me: WARNING: -fstack-protector-strong not supported" >&2;}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $CC in
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wtrampolines" >&5
|
||||||
*gcc*)
|
|
||||||
# Add GCC-specific compiler flags
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wtrampolines" >&5
|
|
||||||
printf %s "checking whether C compiler accepts -Wtrampolines... " >&6; }
|
printf %s "checking whether C compiler accepts -Wtrampolines... " >&6; }
|
||||||
if test ${ax_cv_check_cflags___Wtrampolines+y}
|
if test ${ax_cv_check_cflags__Werror__Wtrampolines+y}
|
||||||
then :
|
then :
|
||||||
printf %s "(cached) " >&6
|
printf %s "(cached) " >&6
|
||||||
else $as_nop
|
else $as_nop
|
||||||
|
|
||||||
ax_check_save_flags=$CFLAGS
|
ax_check_save_flags=$CFLAGS
|
||||||
CFLAGS="$CFLAGS -Wtrampolines"
|
CFLAGS="$CFLAGS -Werror -Wtrampolines"
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
@ -9710,16 +9707,16 @@ main (void)
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_compile "$LINENO"
|
if ac_fn_c_try_compile "$LINENO"
|
||||||
then :
|
then :
|
||||||
ax_cv_check_cflags___Wtrampolines=yes
|
ax_cv_check_cflags__Werror__Wtrampolines=yes
|
||||||
else $as_nop
|
else $as_nop
|
||||||
ax_cv_check_cflags___Wtrampolines=no
|
ax_cv_check_cflags__Werror__Wtrampolines=no
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||||
CFLAGS=$ax_check_save_flags
|
CFLAGS=$ax_check_save_flags
|
||||||
fi
|
fi
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wtrampolines" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__Wtrampolines" >&5
|
||||||
printf "%s\n" "$ax_cv_check_cflags___Wtrampolines" >&6; }
|
printf "%s\n" "$ax_cv_check_cflags__Werror__Wtrampolines" >&6; }
|
||||||
if test "x$ax_cv_check_cflags___Wtrampolines" = xyes
|
if test "x$ax_cv_check_cflags__Werror__Wtrampolines" = xyes
|
||||||
then :
|
then :
|
||||||
BASECFLAGS="$BASECFLAGS -Wtrampolines"
|
BASECFLAGS="$BASECFLAGS -Wtrampolines"
|
||||||
else $as_nop
|
else $as_nop
|
||||||
|
@ -9727,7 +9724,6 @@ else $as_nop
|
||||||
printf "%s\n" "$as_me: WARNING: -Wtrampolines not supported" >&2;}
|
printf "%s\n" "$as_me: WARNING: -Wtrampolines not supported" >&2;}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
case $GCC in
|
case $GCC in
|
||||||
yes)
|
yes)
|
||||||
|
|
10
configure.ac
10
configure.ac
|
@ -2453,13 +2453,9 @@ AS_VAR_IF([with_strict_overflow], [yes],
|
||||||
|
|
||||||
# Enable flags that warn and protect for potential security vulnerabilities.
|
# Enable flags that warn and protect for potential security vulnerabilities.
|
||||||
# These flags should be enabled by default for all builds.
|
# These flags should be enabled by default for all builds.
|
||||||
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough], [BASECFLAGS="$BASECFLAGS -Wimplicit-fallthrough"], [AC_MSG_WARN([-Wimplicit-fallthrough not supported])])
|
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough], [BASECFLAGS="$BASECFLAGS -Wimplicit-fallthrough"], [AC_MSG_WARN([-Wimplicit-fallthrough not supported])], [-Werror])
|
||||||
AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [BASECFLAGS="$BASECFLAGS -fstack-protector-strong"], [AC_MSG_WARN([-fstack-protector-strong not supported])])
|
AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [BASECFLAGS="$BASECFLAGS -fstack-protector-strong"], [AC_MSG_WARN([-fstack-protector-strong not supported])], [-Werror])
|
||||||
case $CC in
|
AX_CHECK_COMPILE_FLAG([-Wtrampolines], [BASECFLAGS="$BASECFLAGS -Wtrampolines"], [AC_MSG_WARN([-Wtrampolines not supported])], [-Werror])
|
||||||
*gcc*)
|
|
||||||
# Add GCC-specific compiler flags
|
|
||||||
AX_CHECK_COMPILE_FLAG([-Wtrampolines], [BASECFLAGS="$BASECFLAGS -Wtrampolines"], [AC_MSG_WARN([-Wtrampolines not supported])])
|
|
||||||
esac
|
|
||||||
|
|
||||||
case $GCC in
|
case $GCC in
|
||||||
yes)
|
yes)
|
||||||
|
|
Loading…
Reference in New Issue