Skip to content

bpo-46600: ./configure --with-pydebug uses -Og with clang #31052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix the test checking if the C compiler supports ``-Og`` option in the
``./configure`` script to also use ``-Og`` on clang which supports it. Patch
by Victor Stinner.
52 changes: 45 additions & 7 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 23 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,28 @@ case $CC in
fi
esac

# Check if CC supports -Og optimization level
_SAVE_VAR([CFLAGS])
CFLAGS="-Og"
AC_CACHE_CHECK([if $CC supports -Og optimization level],
[ac_cv_cc_supports_og],
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM([[]], [[]])
],[
ac_cv_cc_supports_og=yes
],[
ac_cv_cc_supports_og=no
])
)
_RESTORE_VAR([CFLAGS])

# Optimization messes up debuggers, so turn it off for
# debug builds.
PYDEBUG_CFLAGS="-O0"
AS_VAR_IF([ac_cv_cc_supports_og], [yes],
[PYDEBUG_CFLAGS="-Og"])

# tweak OPT based on compiler and platform, only if the user didn't set
# it on the command line
AC_SUBST(OPT)
Expand All @@ -1816,13 +1838,7 @@ then
case $ac_cv_prog_cc_g in
yes)
if test "$Py_DEBUG" = 'true' ; then
# Optimization messes up debuggers, so turn it off for
# debug builds.
if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
OPT="-g -Og -Wall"
else
OPT="-g -O0 -Wall"
fi
OPT="-g $PYDEBUG_CFLAGS -Wall"
else
OPT="-g $WRAP -O3 -Wall"
fi
Expand Down