public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Building with recent GCC versions: gdbsupport/gdb_assert.h:35:4: error: 'nonnull' argument 'filename' compared to NULL [-Werror=nonnull-compare]
@ 2021-07-16 22:53 Jan-Benedict Glaw
  2021-07-17  1:10 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Jan-Benedict Glaw @ 2021-07-16 22:53 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]

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

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Building with recent GCC versions: gdbsupport/gdb_assert.h:35:4: error: 'nonnull' argument 'filename' compared to NULL [-Werror=nonnull-compare]
  2021-07-16 22:53 Building with recent GCC versions: gdbsupport/gdb_assert.h:35:4: error: 'nonnull' argument 'filename' compared to NULL [-Werror=nonnull-compare] Jan-Benedict Glaw
@ 2021-07-17  1:10 ` Alan Modra
  2021-07-19 15:44   ` Jan-Benedict Glaw
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2021-07-17  1:10 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: binutils

On Sat, Jul 17, 2021 at 12:53:25AM +0200, Jan-Benedict Glaw wrote:
> Hi!
> 
> I noticed that when building GDB with a quite recent gcc (ie. "gcc

Wrong mailing list?

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Building with recent GCC versions: gdbsupport/gdb_assert.h:35:4: error: 'nonnull' argument 'filename' compared to NULL [-Werror=nonnull-compare]
  2021-07-17  1:10 ` Alan Modra
@ 2021-07-19 15:44   ` Jan-Benedict Glaw
  2021-07-20 23:42     ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Jan-Benedict Glaw @ 2021-07-19 15:44 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

Hi Alan,

On Sat, 2021-07-17 10:40:44 +0930, Alan Modra <amodra@gmail.com> wrote:
> On Sat, Jul 17, 2021 at 12:53:25AM +0200, Jan-Benedict Glaw wrote:
> > I noticed that when building GDB with a quite recent gcc (ie. "gcc
> 
> Wrong mailing list?

Maybe not: I asked on gcc-patches about this build issue, Martin Sebor
(who implemented the patch causing the breakage) answered to this (cf.
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575568.html).

Quoting:
===================== 8< ---------------------------------------------
> Code is this:
> 
>   31 class unlinker
>   32 {
>   33  public:
>   34
>   35   unlinker (const char *filename) ATTRIBUTE_NONNULL (2)
>   36     : m_filename (filename)
>   37   {
>   38     gdb_assert (filename != NULL);
>   39   }
> 
> I'm quite undecided whether this is bad behavior of GCC or bad coding
> style in Binutils/GDB, or both.

A warning should be expected in this case.  Before the recent GCC
change it was inadvertently suppressed in gdb_assert macros by its
operand being enclosed in parentheses.
----------------------------- >8 ====================================

Thanks,
  Jan-Benedict

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Building with recent GCC versions: gdbsupport/gdb_assert.h:35:4: error: 'nonnull' argument 'filename' compared to NULL [-Werror=nonnull-compare]
  2021-07-19 15:44   ` Jan-Benedict Glaw
@ 2021-07-20 23:42     ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2021-07-20 23:42 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: binutils

On Mon, Jul 19, 2021 at 05:44:56PM +0200, Jan-Benedict Glaw wrote:
> Hi Alan,
> 
> On Sat, 2021-07-17 10:40:44 +0930, Alan Modra <amodra@gmail.com> wrote:
> > On Sat, Jul 17, 2021 at 12:53:25AM +0200, Jan-Benedict Glaw wrote:
> > > I noticed that when building GDB with a quite recent gcc (ie. "gcc
> > 
> > Wrong mailing list?
> 
> Maybe not:

I should have said blunty, you are posting this to the wrong mailing
list.  GDB issues should be posted to one of the GDB lists, in this
case gdb@sourceware.org seems appropriate.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-20 23:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 22:53 Building with recent GCC versions: gdbsupport/gdb_assert.h:35:4: error: 'nonnull' argument 'filename' compared to NULL [-Werror=nonnull-compare] Jan-Benedict Glaw
2021-07-17  1:10 ` Alan Modra
2021-07-19 15:44   ` Jan-Benedict Glaw
2021-07-20 23:42     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).