[PATCHv2] fix failure when building with --disable-debug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When building with --disable-debug, VIR_DEBUG expands to a nop.
But parameters to VIR_DEBUG can be variables that are passed only
to VIR_DEBUG. In the case the building system complains about unused
variables.
---
 cfg.mk             |    2 ++
 src/util/logging.h |    8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/cfg.mk b/cfg.mk
index 7664d5d..6e036fb 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -750,6 +750,8 @@ $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protoco
 	$(MAKE) -C src remote/remote_client_bodies.h
 
 # List all syntax-check exemptions:
+exclude_file_name_regexp--sc_avoid_attribute_unused_in_header = ^src/util/logging\.h$$
+
 exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.c$$
 
 _src1=libvirt|fdstream|qemu/qemu_monitor|util/(command|util)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller
diff --git a/src/util/logging.h b/src/util/logging.h
index 70318d0..7cc5823 100644
--- a/src/util/logging.h
+++ b/src/util/logging.h
@@ -34,8 +34,14 @@
 #  define VIR_DEBUG_INT(category, f, l, ...)                            \
     virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, __VA_ARGS__)
 # else
+/**
+ * virLogEatParam:
+ *
+ * Do nothing but eat parameters.
+ */
+static inline void virLogEatParam(void *unused ATTRIBUTE_UNUSED, ...) {}
 #  define VIR_DEBUG_INT(category, f, l, ...)    \
-    do { } while (0)
+    virLogEatParam((void*)category, f, l, __VA_ARGS__)
 # endif /* !ENABLE_DEBUG */
 
 # define VIR_INFO_INT(category, f, l, ...)                              \
-- 
1.7.10.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]