gh-128042: Emit a `configure warning when -O0 and --enable-optimizations` are combined (#137975)
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
Taegyun Kim 2025-08-27 08:00:43 +09:00 committed by GitHub
parent 5ae8b97f6b
commit ffaec6e2a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View file

@ -0,0 +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.

7
configure generated vendored
View file

@ -8407,6 +8407,13 @@ fi
if test "$Py_OPT" = 'true' ; then
# Check for conflicting CFLAGS=-O0 and --enable-optimizations
case "$CFLAGS" in
*-O0*)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: CFLAGS contains -O0 which may conflict with --enable-optimizations. Consider removing -O0 from CFLAGS for optimal performance." >&5
printf "%s\n" "$as_me: WARNING: CFLAGS contains -O0 which may conflict with --enable-optimizations. Consider removing -O0 from CFLAGS for optimal performance." >&2;}
;;
esac
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
# compile working code using it and both test_distutils and test_gdb are
# broken when you do manage to get a toolchain that works with it. People

View file

@ -1823,6 +1823,14 @@ fi],
[AC_MSG_RESULT([no])])
if test "$Py_OPT" = 'true' ; then
# Check for conflicting CFLAGS=-O0 and --enable-optimizations
case "$CFLAGS" in
*-O0*)
AC_MSG_WARN([m4_normalize([
CFLAGS contains -O0 which may conflict with --enable-optimizations.
Consider removing -O0 from CFLAGS for optimal performance.])])
;;
esac
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
# compile working code using it and both test_distutils and test_gdb are
# broken when you do manage to get a toolchain that works with it. People