chiark / gitweb /
allow compiler to check dbg() arguments on non-debug builds
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>
Mon, 29 Sep 2008 16:50:21 +0000 (17:50 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Mon, 29 Sep 2008 16:54:21 +0000 (18:54 +0200)
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
udev/lib/libudev-private.h

index 162b33aef68e668ba0dac733419dcb457121286a..8f847158b2edd8fbb57357c0df2096076dd77dce 100644 (file)
 #include <syslog.h>
 #include "libudev.h"
 
+static inline void __attribute__ ((format(printf, 2, 3)))
+log_null(struct udev *udev, const char *format, ...)
+{
+}
+
 #ifdef USE_LOG
 #ifdef USE_DEBUG
 #define dbg(udev, arg...) \
        udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg)
 #else
-#define dbg(format, arg...) do { } while (0)
+#define dbg log_null
 #endif /* USE_DEBUG */
 
 #define info(udev, arg...) \
@@ -37,9 +42,9 @@
 #define err(udev, arg...) \
        udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg)
 #else
-#define dbg(format, arg...) do { } while (0)
-#define info(format, arg...) do { } while (0)
-#define err(format, arg...) do { } while (0)
+#define dbg log_null
+#define info log_null
+#define err log_null
 #endif
 
 /* libudev */