From 0ddc6bc8f41e597ba4c21df5256d6970c3d3ee6b Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Tue, 24 Jun 2025 07:43:37 -0500 Subject: [PATCH] Fix MinGW64/MSYS2 w/GCC 15.1 warning As reported by Steve, VK3SIR on the mailing list: On compilation, through a fully up-to-date MinGW64/MSYS2 environment, we receive the following warnings: .... make[3]: Entering directory '/home/sir/src/hamlib/build/src' CC rig.lo ../../src/src/rig.c: In function 'rig_init': ../../src/src/rig.c:624:45: warning: unknown conversion type character 'z' in format [-Wformat=] 624 | rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_struct\n", needed); | ^ ../../src/src/rig.c:624:32: warning: too many arguments for format [-Wformat-extra-args] 624 | rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_struct\n", needed); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/src/rig.c:657:45: warning: unknown conversion type character 'z' in format [-Wformat=] 657 | rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_cache\n", needed); | ^ ../../src/src/rig.c:657:32: warning: too many arguments for format [-Wformat-extra-args] 657 | rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_cache\n", needed); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CC serial.lo .... The '%z' modifier is also found in rigs/icom/icom.c but with a 'u' conversion specifier. Turns out that since 'needed' in this function is of type 'size_t' which is an unsigned integer so the 'u' is required. --- src/rig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rig.c b/src/rig.c index 951d1c004..b2958407a 100644 --- a/src/rig.c +++ b/src/rig.c @@ -621,7 +621,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model) * and especially the callbacks */ needed = sizeof(RIG); - rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_struct\n", needed); + rig_debug(RIG_DEBUG_TRACE, "Requesting %zu bytes for rig_struct\n", needed); rig = calloc(1, needed); if (rig == NULL) @@ -654,7 +654,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model) // Allocate space for cached data needed = sizeof(struct rig_cache); - rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_cache\n", needed); + rig_debug(RIG_DEBUG_TRACE, "Requesting %zu bytes for rig_cache\n", needed); CACHE(rig) = calloc(1, needed); if (!CACHE(rig)) {