Debug build fails

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

 



udevadm-info.c: In function âprint_all_attributesâ:
udevadm-info.c:65: error: âudevâ undeclared (first use in this function)
udevadm-info.c:65: error: (Each undeclared identifier is reported only once
udevadm-info.c:65: error: for each function it appears in.)
udevadm-info.c:72: error: âinfoâ undeclared (first use in this function)


The dbg() macro sucks.  The disabled version should be an inline
function, so it catches these errors on normal builds. 

Obviously the callers need to be fixed before this can be applied.

------------>

Allow compiler to check dbg() arguments on non-debug builds

Signed-off-by: Alan Jenkins <alan-jenkins@xxxxxxxxxxxxxx>

diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
index 162b33a..8f84715 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 */




--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux