summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2008-09-29 17:50:21 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-09-29 18:54:21 +0200
commit9176ac1f4e42f71df692773651898100b253774c (patch)
treeeebe70b5df8c61e11f00dc49cfec66077feadc66
parent120ff8a0e8666b9be84fbd1c22ceeef1b1bd0158 (diff)
allow compiler to check dbg() arguments on non-debug builds
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
-rw-r--r--udev/lib/libudev-private.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
index 162b33aef6..8f847158b2 100644
--- a/udev/lib/libudev-private.h
+++ b/udev/lib/libudev-private.h
@@ -23,12 +23,17 @@
#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 */