Building with recent GCC versions: gdbsupport/gdb_assert.h:35:4: error: 'nonnull' argument 'filename' compared to NULL [-Werror=nonnull-compare]

Jan-Benedict Glaw jbglaw@lug-owl.de
Fri Jul 16 22:53:25 GMT 2021


Hi!

I noticed that when building GDB with a quite recent gcc (ie. "gcc
(Debian 20210630-1) 12.0.0 20210630" from Debian's gcc-snapshot
package), GDB will fail to build for all targets.

..../configure --target=aarch64-linux --prefix=/tmp/gdb-aarch64-linux
[...]
make all-gdb
[...]
  CXX    compile/compile-object-run.o
  CXX    compile/compile.o
In file included from ./../gdbsupport/common-defs.h:126,
                 from ./defs.h:28,
                 from compile/compile.c:20:
./../gdbsupport/gdb_unlinker.h: In constructor 'gdb::unlinker::unlinker(const char*)':
./../gdbsupport/gdb_assert.h:35:4: error: 'nonnull' argument 'filename' compared to NULL [-Werror=nonnull-compare]
   35 |   ((void) ((expr) ? 0 :                                                       \
      |   ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   36 |            (gdb_assert_fail (#expr, __FILE__, __LINE__, FUNCTION_NAME), 0)))
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../gdbsupport/gdb_unlinker.h:38:5: note: in expansion of macro 'gdb_assert'
   38 |     gdb_assert (filename != NULL);
      |     ^~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:1641: compile/compile.o] Error 1
make[1]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-linux/3/binutils-gdb/gdb'
make: *** [Makefile:11410: all-gdb] Error 2


Thanks,
  Jan-Benedict

-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20210717/9161d29f/attachment.sig>


More information about the Binutils mailing list