8000 Enable subset of flags with low performance impact and no warnings · python/cpython@98d9ea0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 98d9ea0

Browse files
committed
Enable subset of flags with low performance impact and no warnings
1 parent 1e48156 commit 98d9ea0

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

configure

Lines changed: 164 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,6 +2451,18 @@ AS_VAR_IF([with_strict_overflow], [yes],
24512451
[BASECFLAGS="$BASECFLAGS $STRICT_OVERFLOW_CFLAGS"],
24522452
[BASECFLAGS="$BASECFLAGS $NO_STRICT_OVERFLOW_CFLAGS"])
24532453

2454+
2455+
# Enable flags that warn and protect for potential security vulnerabilities.
2456+
# These flags should be enabled by default for all builds.
2457+
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough], [BASECFLAGS="$BASECFLAGS -Wimplicit-fallthrough"], [AC_MSG_WARN([-Wimplicit-fallthrough not supported])])
2458+
AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [BASECFLAGS="$BASECFLAGS -fstack-protector-strong"], [AC_MSG_WARN([-fstack-protector-strong not supported])])
2459+
AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [BASECFLAGS="$BASECFLAGS -fno-strict-overflow"], [AC_MSG_WARN([-fno-strict-overflow not supported])])
2460+
case $CC in
2461+
*gcc*)
2462+
# Add GCC-specific compiler flags
2463+
AX_CHECK_COMPILE_FLAG([-Wtrampolines], [BASECFLAGS="$BASECFLAGS -Wtrampolines"], [AC_MSG_WARN([-Wtrampolines not supported])])
2464+
esac
2465+
24542466
case $GCC in
24552467
yes)
24562468
CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"

0 commit comments

Comments
 (0)
0