Skip to content

Commit f418c33

Browse files
committed
Merge #16435: autoconf: Sane --enable-debug defaults.
d6ac25b autoconf: Sane --enable-debug defaults. (Carl Dong) Pull request description: ``` Don't optimize even if variables adhere to as-if rule. This is a somewhat sane default for debugging. ``` ----- Fixes: #14830 This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past. ACKs for top commit: jonasschnelli: Tested ACK d6ac25b Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
2 parents 67be6d7 + d6ac25b commit f418c33

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

configure.ac

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no)
239239
# Enable debug
240240
AC_ARG_ENABLE([debug],
241241
[AS_HELP_STRING([--enable-debug],
242-
[use debug compiler flags and macros (default is no)])],
242+
[use compiler flags and macros suited for debugging (default is no)])],
243243
[enable_debug=$enableval],
244244
[enable_debug=no])
245245

@@ -271,12 +271,9 @@ if test "x$enable_debug" = xyes; then
271271
if test "x$CXXFLAGS_overridden" = xno; then
272272
CXXFLAGS=""
273273
fi
274-
# Prefer -Og, fall back to -O0 if that is unavailable.
275-
AX_CHECK_COMPILE_FLAG(
276-
[-Og],
277-
[[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -Og"]],
278-
[AX_CHECK_COMPILE_FLAG([-O0],[[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"]],,[[$CXXFLAG_WERROR]])],
279-
[[$CXXFLAG_WERROR]])
274+
275+
# Disable all optimizations
276+
AX_CHECK_COMPILE_FLAG([-O0], [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"]],,[[$CXXFLAG_WERROR]])
280277

281278
# Prefer -g3, fall back to -g if that is unavailable.
282279
AX_CHECK_COMPILE_FLAG(

0 commit comments

Comments
 (0)