diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-10-13 15:50:29 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-11-07 09:54:56 +0100 |
commit | 59722031744e76c5619ed5b46b8aae76b01b32ac (patch) | |
tree | 31b76a426bd405718b9a0285283174111c711d2f /log.c | |
parent | 50d46ec847492dbcf6f0b15221188ad439d5e572 (diff) | |
download | passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.gz passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.bz2 passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.lz passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.xz passt-59722031744e76c5619ed5b46b8aae76b01b32ac.tar.zst passt-59722031744e76c5619ed5b46b8aae76b01b32ac.zip |
log: Enable format warnings
logmsg() takes printf like arguments, but because it's not a built in, the
compiler won't generate warnings if the format string and parameters don't
match. Enable those by using the format attribute.
Strictly speaking this is a gcc extension, but I believe it is also
supported by some other common compilers. We already use some other
attributes in various places. For now, just use it and we can worry about
compilers that don't support it if it comes up.
This exposes some warnings from existing callers, both in gcc and in
clang-tidy:
- Some are straight out bugs, which we correct
- It's occasionally useful to invoke the logging functions with an empty
string, which gcc objects to, so disable that specific warning in the
Makefile
- Strictly speaking the C standard requires that the parameter for a %p
be a (void *), not some other pointer type. That's only likely to cause
problems in practice on weird architectures with different sized
representations for pointers to different types. Nonetheless add the
casts to make it happy.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'log.c')
0 files changed, 0 insertions, 0 deletions