On Wed, Jan 7, 2026 at 11:43 PM Jan Beulich <[email protected]> wrote: > > On 07.01.2026 23:18, Andrew Pinski wrote: > > On Wed, Jan 7, 2026 at 1:31 AM Maciej W. Rozycki <[email protected]> wrote: > >> --- binutils-gdb.orig/libiberty/objalloc.c > >> +++ binutils-gdb/libiberty/objalloc.c > >> @@ -178,7 +178,7 @@ objalloc_free (struct objalloc *o) > >> { > >> struct objalloc_chunk *l; > >> > >> - l = (struct objalloc_chunk *) o->chunks; > >> + l = o != NULL ? (struct objalloc_chunk *) o->chunks : NULL; > > > > I think the following would be cleaner and easier to understand: > > ``` > > /* Handle a nullptr as being a no-op. */ > > if (o == NULL) > > return; > > l = (struct objalloc_chunk *) o->chunks; > > ``` > > If already we're re-working this, can't the cast be dropped as well? Or is > libiberty still required to be buildable on pre-C89?
The casts can't be removed as libiberty is compiled with -Wc++-compat. That is we want to use the subset of C and C++ here (for the most part). That means requiring cast between void* and another pointer type. Thanks, Andrew Pinski > > Jan
