diff options
Diffstat (limited to 'tools/minicargo/debug.h')
-rw-r--r-- | tools/minicargo/debug.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/minicargo/debug.h b/tools/minicargo/debug.h index 00cd1412..f723d359 100644 --- a/tools/minicargo/debug.h +++ b/tools/minicargo/debug.h @@ -9,9 +9,15 @@ extern void Debug_EnterScope(const char* name, dbg_cb_t ); extern void Debug_LeaveScope(const char* name, dbg_cb_t ); extern void Debug_Print(dbg_cb_t cb); -#define DEBUG(fmt) do { Debug_Print([&](auto& os){ os << "DEBUG: " << fmt; }); } while(0) -#define TODO(fmt) do { Debug_Print([&](auto& os){ os << "TODO: " << fmt; }); abort(); } while(0) -#define TRACE_FUNCTION_F(fmt) DebugFunctionScope trace_function_hdr { __FUNCTION__, [&](auto& os){ os << fmt; } } +#if defined(NOLOG) +# define DEBUG(fmt) do { } while(0) +# define TODO(fmt) do { } while(0) +# define TRACE_FUNCTION_F(fmt) do{}while(0) +#else +# define DEBUG(fmt) do { Debug_Print([&](auto& os){ os << "DEBUG: " << fmt; }); } while(0) +# define TODO(fmt) do { Debug_Print([&](auto& os){ os << "TODO: " << fmt; }); abort(); } while(0) +# define TRACE_FUNCTION_F(fmt) DebugFunctionScope trace_function_hdr { __FUNCTION__, [&](auto& os){ os << fmt; } } +#endif namespace { static inline void format_to_stream(::std::ostream& os) { |