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

[libvirt] [PATCHv3] fix failure when building with --disable-debug



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.
---
 src/util/logging.h |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/util/logging.h b/src/util/logging.h
index 70318d0..2e70af4 100644
--- a/src/util/logging.h
+++ b/src/util/logging.h
@@ -34,8 +34,21 @@
 #  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(const char *category,
+                                  const char *funcname,
+                                  long long linenr, ...)
+{
+    category = category;
+    funcname = funcname;
+    linenr = linenr;
+}
 #  define VIR_DEBUG_INT(category, f, l, ...)    \
-    do { } while (0)
+    virLogEatParam(category, f, l, __VA_ARGS__)
 # endif /* !ENABLE_DEBUG */
 
 # define VIR_INFO_INT(category, f, l, ...)                              \
-- 
1.7.10.2


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