-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
common.c/.h: warning: '%s' directive argument is null [-Wformat-overflow=] #2585
Comments
That's odd: the first argument there (that the arrow points to) is What it might more likely complain about is
In a grander scheme of things, some compiler+libc combos:
The macro is defined here: Lines 32 to 40 in 304d41e
It aims to do nothing on platforms where |
Hi Jim, thanks for the express response.
Would it cause (portability) problems or significant overhead to always err on the safe side with: |
Probably such big hammer would not hurt much, after all we have Ideally I'd probably wrap all string printouts into the macro for the peace of mind, but that is a far-away dream just due to sheer scale of the effort and lack of time (help would be welcome though). TBH, here I am more puzzled about why it complains in the first place, and if this is the only spot - maybe I did miss some code path while walking it by eyesight, and something conspires to always have a After all, Slackware 15 is among tested systems, and is not the only one with a compiler that complains of such things, and there are no failures or even warnings on NUT CI... |
FWIW it does compile without problems on Slackware 15.0 with older GCC version 11.2.0 (which, I think, is what we do on CI) |
Is this the same type of build in both systems, or a cross-build etc.? Looking at This is a bit of an opposite of your report though, the program does not crash. Can you check in your |
Thanks, they all seem to be in this same line. So it is less about the macro and more about some way for compiler static analysis to find the problem. Or, chances are, to hallucinate one. |
Exact same build process, configuration and no cross-building or anything else out of the ordinary. For additional information, I get three warnings (in total) throughout the compile process:
|
Thanks, so
I'm trying to remember more reasons why I wanted to keep the almost-noop part of the macro definition, but can't at the moment. Maybe consistency of how the system Would you be open to a |
Sounds like a perfect deal 😉 I just stumbled upon this getting a testing package (of the proposed changes in #2565) shipped out to users affected by the APC BX problem, so wanted to check back if this is something that could cause additional problems or rather a compiler oddity that can be ignored safely for now. |
Re-confirmed with |
…: introduce `configure --enable-NUT_STRARG-always` setting [networkupstools#2585] Signed-off-by: Jim Klimov <[email protected]>
…ys` setting have `auto` detection by default [networkupstools#2585] Flips to "yes" for gcc-13.x (clang having issues is not proven at the moment) Signed-off-by: Jim Klimov <[email protected]>
…hing [networkupstools#2585] Signed-off-by: Jim Klimov <[email protected]>
Getting a couple of compiler warnings while building recent master with gcc version 13.2.0 on Slackware 15.1 (-current)
The text was updated successfully, but these errors were encountered: