Skip to content

Commit ffaec6e

Browse files
pythongh-128042: Emit a configure warning when -O0 and --enable-optimizations are combined (python#137975)
Co-authored-by: Adam Turner <[email protected]>
1 parent 5ae8b97 commit ffaec6e

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``./configure`` now warns when ``--enable-optimizations`` and ``CFLAGS=-O0`` are both set, suggesting removing ``-O0`` from ``CFLAGS`` for optimal performance. Patch by Taegyun Kim.

configure

Lines changed: 7 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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,14 @@ fi],
18231823
[AC_MSG_RESULT([no])])
18241824

18251825
if test "$Py_OPT" = 'true' ; then
1826+
# Check for conflicting CFLAGS=-O0 and --enable-optimizations
1827+
case "$CFLAGS" in
1828+
*-O0*)
1829+
AC_MSG_WARN([m4_normalize([
1830+
CFLAGS contains -O0 which may conflict with --enable-optimizations.
1831+
Consider removing -O0 from CFLAGS for optimal performance.])])
1832+
;;
1833+
esac
18261834
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
18271835
# compile working code using it and both test_distutils and test_gdb are
18281836
# broken when you do manage to get a toolchain that works with it. People

0 commit comments

Comments
 (0)