From 7b4da66e8d4aa5d202b471f9c7359a041d8b3145 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Wed, 9 Dec 2015 11:53:22 -0800 Subject: [PATCH 1/3] Add duplicate macros with namespace prefix Add duplicate macros to console.h with `CONSOLE_BRIDGE_` prepended. First step in fixing #18. --- include/console_bridge/console.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/console_bridge/console.h b/include/console_bridge/console.h index 83776e5..8f17346 100644 --- a/include/console_bridge/console.h +++ b/include/console_bridge/console.h @@ -63,6 +63,18 @@ \} */ +#define CONSOLE_BRIDGE_logError(fmt, ...) \ + console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__) + +#define CONSOLE_BRIDGE_logWarn(fmt, ...) \ + console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__) + +#define CONSOLE_BRIDGE_logInform(fmt, ...) \ + console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__) + +#define CONSOLE_BRIDGE_logDebug(fmt, ...) \ + console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__) + #define logError(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__) #define logWarn(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__) From 4c529c62e606e3e6fdb9bca2468ad397f2c011ae Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Wed, 9 Dec 2015 13:10:24 -0800 Subject: [PATCH 2/3] Add deprecation warning for old macros --- include/console_bridge/console.h | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/include/console_bridge/console.h b/include/console_bridge/console.h index 8f17346..136f3a0 100644 --- a/include/console_bridge/console.h +++ b/include/console_bridge/console.h @@ -41,6 +41,17 @@ #include "exportdecl.h" +#ifdef __GNUC__ +#define CONSOLE_BRIDGE_DEPRECATED __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define CONSOLE_BRIDGE_DEPRECATED __declspec(deprecated) +#else +#pragma message("WARNING: You need to implement DEPRECATED for this compiler") +#define CONSOLE_BRIDGE_DEPRECATED +#endif + +static inline void CONSOLE_BRIDGE_DEPRECATED console_bridge_deprecated() {} + /** \file console.h \defgroup logging Logging Macros \{ @@ -75,13 +86,21 @@ #define CONSOLE_BRIDGE_logDebug(fmt, ...) \ console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__) -#define logError(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__) +#define logError(fmt, ...) \ + console_bridge_deprecated(); \ + console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__) -#define logWarn(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__) +#define logWarn(fmt, ...) \ + console_bridge_deprecated(); \ + console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__) -#define logInform(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__) +#define logInform(fmt, ...) \ + console_bridge_deprecated(); \ + console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__) -#define logDebug(fmt, ...) console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__) +#define logDebug(fmt, ...) \ + console_bridge_deprecated(); \ + console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__) /** \brief Message namespace. This contains classes needed to From 1b687b70a4a5018a19159dc93439f7cc06c3d736 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Wed, 9 Dec 2015 13:48:00 -0800 Subject: [PATCH 3/3] Bump minor to 0.3 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a07cfb..f900640 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8) project(console_bridge) set (CONSOLE_BRIDGE_MAJOR_VERSION 0) -set (CONSOLE_BRIDGE_MINOR_VERSION 2) -set (CONSOLE_BRIDGE_PATCH_VERSION 8) +set (CONSOLE_BRIDGE_MINOR_VERSION 3) +set (CONSOLE_BRIDGE_PATCH_VERSION 0) set (CONSOLE_BRIDGE_VERSION ${CONSOLE_BRIDGE_MAJOR_VERSION}.${CONSOLE_BRIDGE_MINOR_VERSION}.${CONSOLE_BRIDGE_PATCH_VERSION}) message (STATUS "${PROJECT_NAME} version ${CONSOLE_BRIDGE_VERSION}")