debug: use macros for DEBUG_ONLY macro
This commit is contained in:
parent
8212048750
commit
0cf530c2de
14
debug.hpp
14
debug.hpp
@ -36,8 +36,18 @@
|
|||||||
|
|
||||||
|
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
/// enable some code only if assertions et al are enabled
|
/// enable some code only if assertions are enabled
|
||||||
#define DEBUG_ONLY(X) do { if constexpr (debug_enabled) { X } } while (0)
|
///
|
||||||
|
/// explicitly does not use constexpr if to remove the code as some paths may
|
||||||
|
/// refer to variables which do not always exist, and current compiler
|
||||||
|
/// implementations are a little picky here.
|
||||||
|
#ifndef NDEBUG
|
||||||
|
#define DEBUG_ONLY(X) do { X; } while (0)
|
||||||
|
#else
|
||||||
|
#define DEBUG_ONLY(X) do { ; } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#define DEBUG_ONLY(X) do { if constexpr (debug_enabled) { X } } while (0)
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user