From 1e184f95e459bf080be05022a4007f80e80da0e1 Mon Sep 17 00:00:00 2001 From: Alex Lian Date: Sun, 27 Jan 2013 21:55:34 -0500 Subject: [PATCH] Fix enabling of LIBNFC_DEBUG_OUTPUT - inclusion of log-printf.c didn't align with needed preprocessor definitions - Added extra #error as well as preprocessor protection - fixed CMakeList to specify -DLOG as appropriate per the header log.h usage --- CMakeLists.txt | 2 +- libnfc/log-printf.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e3aa50..fb668b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") # Options SET(LIBNFC_DEBUG_OUTPUT OFF CACHE BOOL "Debug output of communication with the NFC chip") IF(LIBNFC_DEBUG_OUTPUT) - ADD_DEFINITIONS(-DDEBUG -g3) + ADD_DEFINITIONS(-DDEBUG -DLOG -g3) ENDIF(LIBNFC_DEBUG_OUTPUT) # Doxygen diff --git a/libnfc/log-printf.c b/libnfc/log-printf.c index 200ecf8..75c5e27 100644 --- a/libnfc/log-printf.c +++ b/libnfc/log-printf.c @@ -25,6 +25,12 @@ #include #include +#ifndef LOG + // Leaving in a preprocessor error, as the build system should skip this + // file otherwise. + #error "No logging defined, but log-printf.c still compiled." +#else // LOG + void log_init(const nfc_context *context) { @@ -67,3 +73,5 @@ log_put(const uint8_t group, const char *category, const uint8_t priority, const } } } + +#endif // LOG