Fix compilation in release mode.
_DEBUG_TRACE is undefined in release builds, leading to compiler errors.
This commit is contained in:
parent
3e1f3d2073
commit
cc024e870f
Binary file not shown.
|
@ -67,33 +67,39 @@ extern thread_local const DWORD _CurrentThreadId;
|
|||
// TODO : Use Boost.Format http://www.boost.org/doc/libs/1_53_0/libs/format/index.html
|
||||
extern thread_local std::string _logPrefix;
|
||||
|
||||
#define LOG_FUNC_BEGIN \
|
||||
do { if (_DEBUG_TRACE) if(g_bPrintfOn) { \
|
||||
if (_logPrefix.empty()) { \
|
||||
std::stringstream tmp; \
|
||||
tmp << __FILENAME__ << " (0x" << std::hex << std::uppercase << _CurrentThreadId << "): "; \
|
||||
_logPrefix = tmp.str(); \
|
||||
}; \
|
||||
std::stringstream msg; \
|
||||
msg << _logPrefix << __func__ << "(";
|
||||
#ifdef _DEBUG_TRACE
|
||||
#define LOG_FUNC_BEGIN \
|
||||
do { if(g_bPrintfOn) { \
|
||||
if (_logPrefix.empty()) { \
|
||||
std::stringstream tmp; \
|
||||
tmp << __FILENAME__ << " (0x" << std::hex << std::uppercase << _CurrentThreadId << "): "; \
|
||||
_logPrefix = tmp.str(); \
|
||||
}; \
|
||||
std::stringstream msg; \
|
||||
msg << _logPrefix << __func__ << "(";
|
||||
|
||||
// LOG_FUNC_ARG_OUT writes output via all available ostream << operator overloads, adding detail where possible
|
||||
#define LOG_FUNC_ARG(arg) \
|
||||
msg << "\n " << std::setw(26) << std::left << std::setfill(' ') << #arg << " : " << arg;
|
||||
// LOG_FUNC_ARG_OUT writes output via all available ostream << operator overloads, adding detail where possible
|
||||
#define LOG_FUNC_ARG(arg) \
|
||||
msg << "\n " << std::setw(26) << std::left << std::setfill(' ') << #arg << " : " << arg;
|
||||
|
||||
// LOG_FUNC_ARG_OUT prevents expansion of types, by only rendering as a pointer
|
||||
#define LOG_FUNC_ARG_OUT(arg) \
|
||||
msg << "\n " << std::setw(26) << std::left << std::setfill(' ') << #arg << " : 0x" << (void*)arg;
|
||||
// LOG_FUNC_ARG_OUT prevents expansion of types, by only rendering as a pointer
|
||||
#define LOG_FUNC_ARG_OUT(arg) \
|
||||
msg << "\n " << std::setw(26) << std::left << std::setfill(' ') << #arg << " : 0x" << (void*)arg;
|
||||
|
||||
// LOG_FUNC_END closes off function and optional argument logging
|
||||
#define LOG_FUNC_END \
|
||||
msg.seekg(-1, std::ios::end); if (msg.get() != '(') msg << '\n'; \
|
||||
msg << ");\n"; \
|
||||
std::cout << msg.str(); \
|
||||
} } while (0)
|
||||
// LOG_FUNC_END closes off function and optional argument logging
|
||||
#define LOG_FUNC_END \
|
||||
msg.seekg(-1, std::ios::end); if (msg.get() != '(') msg << '\n'; \
|
||||
msg << ");\n"; \
|
||||
std::cout << msg.str(); \
|
||||
} } while (0)
|
||||
#else
|
||||
#define LOG_FUNC_BEGIN ;
|
||||
#define LOG_FUNC_ARG(arg);
|
||||
#define LOG_FUNC_ARG_OUT(arg);
|
||||
#define LOG_FUNC_END ;
|
||||
#endif
|
||||
|
||||
// Short hand defines :
|
||||
|
||||
// Log function without arguments
|
||||
#define LOG_FUNC() LOG_FUNC_BEGIN LOG_FUNC_END
|
||||
|
||||
|
|
|
@ -105,6 +105,11 @@ extern volatile bool g_bPrintfOn;
|
|||
#endif
|
||||
|
||||
/*! DbgPrintf enabled if _DEBUG_TRACE is set */
|
||||
#define DbgPrintf(fmt, ...) do { if (_DEBUG_TRACE) if(g_bPrintfOn) printf(fmt, ##__VA_ARGS__); } while (0)
|
||||
#ifdef _DEBUG_TRACE
|
||||
#define DbgPrintf(fmt, ...) do { if(g_bPrintfOn) printf(fmt, ##__VA_ARGS__); } while (0)
|
||||
#else
|
||||
inline void null_func(...) { }
|
||||
#define DbgPrintf null_func
|
||||
#endif
|
||||
|
||||
#endif CXBX_H
|
||||
|
|
Loading…
Reference in New Issue