diff options
author | Philipp Hahn <hahn@univention.de> | 2020-07-27 07:32:02 +0200 |
---|---|---|
committer | Philipp Hahn <hahn@univention.de> | 2020-07-27 13:24:36 +0200 |
commit | a14161f01c078f6992d9d6b0b8e53616a8b4a638 (patch) | |
tree | 1020e3fbedf1cb8cc0813ba016e081dd9464f14f /libvirt-override.c | |
parent | cfcf988a98b66f350cfbc9af880eacb7c2aebe07 (diff) | |
download | libvirt-python-a14161f01c078f6992d9d6b0b8e53616a8b4a638.tar.gz |
debug: Fix bit-rot in debug output
Let the compiler optimize out the printf() call instead of doing it with the
pre-processor as the later does not catch format string errors or the following
case, where NULLSTR() is used but not defined:
> libvirt-qemu-override.c: In function ‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’:
> libvirt-qemu-override.c:271:34: warning: implicit declaration of function ‘NULLSTR’; did you mean ‘NULL’? [-Wimplicit-function-declaration]
> 271 | pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags);
> | ^~~~~~~
> libvirt-qemu-override.c:39:28: note: in definition of macro ‘DEBUG’
> 39 | while (0) {printf(fmt, __VA_ARGS__);}
> | ^~~~~~~~~~~
> libvirt-qemu-override.c:270:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
> 270 | DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 271 | pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags);
> | ~~~~~~~~~~~~~~
> | |
> | int
> libvirt-qemu-override.c:39:23: note: in definition of macro ‘DEBUG’
> 39 | while (0) {printf(fmt, __VA_ARGS__);}
> | ^~~
> libvirt-qemu-override.c:270:73: note: format string is defined here
> 270 | DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n",
> | ~^
> | |
> | char *
> | %d
Copy the definition of NULLSTR from libvirt/src/internal.h to typewrappers.h
Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'libvirt-override.c')
-rw-r--r-- | libvirt-override.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libvirt-override.c b/libvirt-override.c index 00efe7f..4f92b03 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -41,7 +41,7 @@ extern PyObject *PyInit_cygvirtmod(void); printf(fmt, __VA_ARGS__) #else # define DEBUG(fmt, ...) \ - do {} while (0) + while (0) {printf(fmt, __VA_ARGS__);} #endif |