Debug build fails
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
udev/lib/libudev-private.h +9 -4
@@ -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 */
Kay Sievers
AppliedQuoted 9 lines · Alan Jenkins
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.
Quoted 1 line
Obviously the callers need to be fixed before this can be applied.
Done.
Quoted 1 line
Allow compiler to check
dbg()arguments on non-debug builds
Applied.
Thanks,
Kay