[LEDE-DEV] [PATCH v2] procd: fix build when DEBUG is set

Zefir Kurtisi zefir.kurtisi at neratec.com
Thu Oct 13 08:40:38 PDT 2016


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 renaming the build flag to
UDEV_DEBUG (since it is only used in udevtrigger).

Signed-off-by: Zefir Kurtisi <zefir.kurtisi at neratec.com>
---
Changes to v1:
* rename build flag instead of using undef

 CMakeLists.txt     | 2 +-
 plug/udevtrigger.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b66fad1..444dd20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@ ENDIF()
 SET(LIBS ubox ubus json-c blobmsg_json json_script)
 
 IF(DEBUG)
-  ADD_DEFINITIONS(-DDEBUG -g3)
+  ADD_DEFINITIONS(-DUDEV_DEBUG -g3)
 ENDIF()
 
 IF(EARLY_PATH)
diff --git a/plug/udevtrigger.c b/plug/udevtrigger.c
index 3eba19a..6bb3453 100644
--- a/plug/udevtrigger.c
+++ b/plug/udevtrigger.c
@@ -66,7 +66,7 @@ static void log_message(int priority, const char *format, ...)
         log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \
     } while (0)
 
-#ifdef DEBUG
+#ifdef UDEV_DEBUG
 #undef dbg
 #define dbg(format, arg...)                         \
     do {                                    \
-- 
2.7.4




More information about the Lede-dev mailing list