* Debug build fails
@ 2008-09-29 16:50 Alan Jenkins
2008-09-29 17:02 ` Kay Sievers
0 siblings, 1 reply; 2+ messages in thread
From: Alan Jenkins @ 2008-09-29 16:50 UTC (permalink / raw)
To: linux-hotplug
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@tuffmail.co.uk>
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 */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Debug build fails
2008-09-29 16:50 Debug build fails Alan Jenkins
@ 2008-09-29 17:02 ` Kay Sievers
0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2008-09-29 17:02 UTC (permalink / raw)
To: linux-hotplug
On Mon, 2008-09-29 at 17:50 +0100, Alan Jenkins wrote:
> 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.
Sounds good.
> Obviously the callers need to be fixed before this can be applied.
Done.
> Allow compiler to check dbg() arguments on non-debug builds
Applied.
Thanks,
Kay
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-29 17:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-29 16:50 Debug build fails Alan Jenkins
2008-09-29 17:02 ` Kay Sievers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).