[PATCH] tests: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`)

Mark Wielaard mark@klomp.org
Thu Dec 21 21:23:43 GMT 2023


Hi Sergei,

On Thu, 2023-12-21 at 09:23 +0000, Sergei Trofimovich wrote:
> `gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
> detected minor infelicity in `calloc()` API usage in `elfutils`:
> 
>     elfstrmerge.c: In function 'main':
>     elfstrmerge.c:450:32: error:
>       'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
>       450 |   newscnbufs = calloc (sizeof (void *), newshnums);
>           |                                ^~~~
>     elfstrmerge.c:450:32: note: earlier argument should specify number of elements, later size of each element
> 

Thanks, looks good. Pushed.

Cheers,

Mark


More information about the Elfutils-devel mailing list