diff options
author | Tom de Vries <tdevries@suse.de> | 2023-11-30 21:31:46 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-11-30 21:31:46 +0100 |
commit | d5835df2eebf8e9cd3ae35b683c831c2a16a5269 (patch) | |
tree | 59ea9bd1a82f8e289e4a96004fb724fc20ff1a23 /gdb/configure.ac | |
parent | 946df73fa09e782b15f75fc82729bff6a00d2554 (diff) | |
download | gdb-d5835df2eebf8e9cd3ae35b683c831c2a16a5269.zip gdb-d5835df2eebf8e9cd3ae35b683c831c2a16a5269.tar.gz gdb-d5835df2eebf8e9cd3ae35b683c831c2a16a5269.tar.bz2 |
[gdb/build] Fix adding -DNDEBUG to python flags of release build
In gdb/configure the line:
...
$development || tentative_python_cflags="$tentative_python_cflags -DNDEBUG"
...
intends to ensure that -DNDEBUG is added to the python flags of a release
build.
However, when building gdb-14-branch we have:
...
configure:22024: checking compiler flags for python code
...
configure:22047: result: -fno-strict-aliasing -fwrapv
...
This is a regression since commit db6878ac553 ("Move sourcing of development.sh
to GDB_AC_COMMON"), which introduced a reference before assignment:
...
$development || tentative_python_cflags="$tentative_python_cflags -DNDEBUG"
...
. $srcdir/../bfd/development.sh
...
and consequently -DNDEBUG is never added.
[ This was not obvious to me, but apparently evaluating an empty or undefined
variable in this context is similar to using ':' or 'true', so the line is
evaluated as:
...
true || tentative_python_cflags="$tentative_python_cflags -DNDEBUG"
... ]
Fix this by moving GDB_AC_COMMON up in gdb/configure.ac, similar to how that
was done for gdbserver/configure.ac in commit db6878ac553.
[ Unfortunately, the move might introduce issues similar to the one we're
fixing, and I'm not sure how to check for this. Shellcheck doesn't detect
this type of problem. FWIW, I did run shellcheck (using arguments -xa, in the
src/gdb directory to make sure ../bfd/development.sh is taken into account)
before and after and observed that the number of lines/words/chars in the
shellcheck output is identical. ]
Build & tested on top of trunk.
Also build on top of gdb-14-branch, and observed this in gdb/config.log:
...
configure:25214: checking compiler flags for python code
...
configure:25237: result: -fno-strict-aliasing -fwrapv -DNDEBUG
...
Approved-By: Tom Tromey <tom@tromey.com>
PR build/31099
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31099
Diffstat (limited to 'gdb/configure.ac')
-rw-r--r-- | gdb/configure.ac | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/configure.ac b/gdb/configure.ac index 43e5067..cbde370 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -57,6 +57,8 @@ LT_OUTPUT # necessary, set CXX_DIALECT to some -std=xxx switch. AX_CXX_COMPILE_STDCXX(17, , mandatory) +GDB_AC_COMMON + # Dependency checking. ZW_CREATE_DEPDIR ZW_PROG_COMPILER_DEPENDENCIES([CC]) @@ -1353,7 +1355,6 @@ AC_CHECK_FUNCS([getuid getgid \ setrlimit getrlimit posix_madvise waitpid \ use_default_colors]) AM_LANGINFO_CODESET -GDB_AC_COMMON # Check the return and argument types of ptrace. GDB_AC_PTRACE |