Skip to content

Commit

Permalink
Add deprecation warning for old macros
Browse files Browse the repository at this point in the history
  • Loading branch information
scpeters committed Dec 14, 2015
1 parent 7b4da66 commit 4c529c6
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions include/console_bridge/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
\{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4c529c6

Please sign in to comment.