Re: [Hamlib-developer] Minor cleanup needed
Library to control radio transceivers and receivers
Brought to you by:
n0nb
|
From: Nate B. <n0...@n0...> - 2025-06-24 12:35:59
|
* On 2025 24 Jun 04:33 -0500, Stephen VK3SIR wrote:
> Hi Nate (and Team),
>
> 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
> ....
>
> MinGW64/MSYS2 delivers the GCC 15.1 compiler.
Hi Steve,
I see that "%z" shows up in just four places in the tree. The other two
places are in rigs/icom/icom.c at lines 9035 and 9060. There it is
followed by "u" in both cases which apparently didn't raise a warning.
If you modify the lines in rig.c to match does the warning go away?
> If we do not report then things become bigger later one !
All I can think of is that the compiler now enforces the use of an
unsigned integer. From the printf(3) man page:
z A following integer conversion corresponds to a size_t or
ssize_t argument, or a following n conversion corresponds to a
pointer to a size_t argument.
The size_t(3) man page states size_t is an unsigned integer and here in
rig.c the 'needed' variable is of the size_t type. Thus 'u' should be
correct.
I'll work up a patch for this.
Thanks!
--
"The optimist proclaims that we live in the best of all
possible worlds. The pessimist fears this is true."
Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819
|