There is a collision between the DEBUG set in the CMake file as
flag and the macro defined in log.h, resulting in build error:

In file included from ./procd/initd/init.h:19:0,
                 from ./procd/initd/init.c:33:
./procd/initd/../log.h:20:0: error: "DEBUG" redefined [-Werror]
 #define DEBUG(level, fmt, ...) do { \
 ^
<command-line>:0:0: note: this is the location of the previous definition
cc1: all warnings being treated as errors

This patch fixes the issue by undefining the initial boolean
flag before it is set to the debug log macro.

Signed-off-by: Zefir Kurtisi <zefir.kurt...@neratec.com>
---
 jail/log.h | 3 +++
 log.h      | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/jail/log.h b/jail/log.h
index 74a9f11..bc8c8fe 100644
--- a/jail/log.h
+++ b/jail/log.h
@@ -24,6 +24,9 @@ extern int debug;
        syslog(LOG_ERR, "jail: "fmt, ## __VA_ARGS__); \
        fprintf(stderr,"jail: "fmt, ## __VA_ARGS__); \
        } while (0)
+
+#undef DEBUG
+
 #define DEBUG(fmt, ...) do { \
        if (debug) printf("jail: "fmt, ## __VA_ARGS__); \
        } while (0)
diff --git a/log.h b/log.h
index bf86f1e..90172b1 100644
--- a/log.h
+++ b/log.h
@@ -17,6 +17,8 @@
 
 #include <libubox/ulog.h>
 
+#undef DEBUG
+
 #define DEBUG(level, fmt, ...) do { \
        if (debug >= level) { \
                ulog(LOG_DEBUG, fmt, ## __VA_ARGS__); \
-- 
2.7.4


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to