Bruno Haible via Gnulib discussion list <bug-gnulib@gnu.org> writes: > Building a testdir with a GCC 15 snapshot, I see these warnings: > > ../../gllib/gc-gnulib.c:177:24: warning: 'calloc' sizes specified with > 'sizeof' in the earlier argument and not in the later argument > ../../gllib/gc-gnulib.c:566:24: warning: 'calloc' sizes specified with > 'sizeof' in the earlier argument and not in the later argument > ../../gllib/gc-gnulib.c:637:37: warning: 'calloc' sizes specified with > 'sizeof' in the earlier argument and not in the later argument
There is a few more that were hidden behind the --with-libgcrypt configure option. Pushed the attached flag to fix them. Collin
>From 41d71cfe1bf8495437c431306537243a81ffeb25 Mon Sep 17 00:00:00 2001 From: Collin Funk <collin.fu...@gmail.com> Date: Sun, 4 May 2025 17:19:56 -0700 Subject: [PATCH] crypto/gc: Silence some -Wcalloc-transposed-args warnings, part 2. * lib/gc-libgcrypt.c (gc_hash_open, gc_hash_clone): Swap the arguments to calloc(). --- ChangeLog | 6 ++++++ lib/gc-libgcrypt.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a0b2a1361..e89281a9e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-05-04 Collin Funk <collin.fu...@gmail.com> + + crypto/gc: Silence some -Wcalloc-transposed-args warnings, part 2. + * lib/gc-libgcrypt.c (gc_hash_open, gc_hash_clone): Swap the arguments + to calloc(). + 2025-05-04 Bruno Haible <br...@clisp.org> getlocalename_l-unsafe: Improve support for Solaris 11 OpenIndiana. diff --git a/lib/gc-libgcrypt.c b/lib/gc-libgcrypt.c index 6ab89e4085..86d6a3d482 100644 --- a/lib/gc-libgcrypt.c +++ b/lib/gc-libgcrypt.c @@ -272,7 +272,7 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) gcry_error_t err; Gc_rc rc = GC_OK; - ctx = calloc (sizeof (*ctx), 1); + ctx = calloc (1, sizeof (*ctx)); if (!ctx) return GC_MALLOC_ERROR; @@ -372,7 +372,7 @@ gc_hash_clone (gc_hash_handle handle, gc_hash_handle * outhandle) _gc_hash_ctx *out; int err; - *outhandle = out = calloc (sizeof (*out), 1); + *outhandle = out = calloc (1, sizeof (*out)); if (!out) return GC_MALLOC_ERROR; -- 2.49.0