]> xenbits.xensource.com Git - libvirt.git/commitdiff
fix failure when building with --disable-debug
authorHu Tao <hutao@cn.fujitsu.com>
Fri, 13 Jul 2012 07:50:04 +0000 (15:50 +0800)
committerEric Blake <eblake@redhat.com>
Fri, 13 Jul 2012 12:38:18 +0000 (06:38 -0600)
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

index 70318d04dd81dea4af280305d754fd46ee465ba3..db648cb547e63f573505ff13b1a3380b4bb2a41d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * logging.h: internal logging and debugging
  *
- * Copyright (C) 2006-2008, 2011 Red Hat, Inc.
+ * Copyright (C) 2006-2008, 2011-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #  define VIR_DEBUG_INT(category, f, l, ...)                            \
     virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, __VA_ARGS__)
 # else
+/**
+ * virLogEatParams:
+ *
+ * Do nothing but eat parameters.
+ */
+static inline void virLogEatParams(const char *unused, ...)
+{
+    /* Silence gcc */
+    unused = unused;
+}
 #  define VIR_DEBUG_INT(category, f, l, ...)    \
-    do { } while (0)
+    virLogEatParams(category, f, l, __VA_ARGS__)
 # endif /* !ENABLE_DEBUG */
 
 # define VIR_INFO_INT(category, f, l, ...)                              \