diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-11-02 11:07:23 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-11-02 11:07:23 +0800 |
commit | 1d02810c3cf908bfba7c15ae50eb5314603b9d85 (patch) | |
tree | 79dd5e4ef4c3ff79db0912ba546f08e61a7a8c10 /src/include/debug.hpp | |
parent | 7111acba04d72fe4084b1a1f3209ff83efe8614d (diff) | |
parent | 8b53b38f40625ab0510f541d69db3f83332a830a (diff) | |
download | mrust-1d02810c3cf908bfba7c15ae50eb5314603b9d85.tar.gz |
Merge branch 'nightly-1.29' - #95 Working support for rustc 1.29
Diffstat (limited to 'src/include/debug.hpp')
-rw-r--r-- | src/include/debug.hpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/include/debug.hpp b/src/include/debug.hpp index 3f059301..534523c2 100644 --- a/src/include/debug.hpp +++ b/src/include/debug.hpp @@ -14,13 +14,18 @@ extern int g_debug_indent_level; +#ifndef DEBUG_EXTRA_ENABLE +# define DEBUG_EXTRA_ENABLE // Files can override this with their own flag if needed (e.g. `&& g_my_debug_on`) +#endif + #ifndef DISABLE_DEBUG +# define DEBUG_ENABLED (debug_enabled() DEBUG_EXTRA_ENABLE) # define INDENT() do { g_debug_indent_level += 1; assert(g_debug_indent_level<300); } while(0) # define UNINDENT() do { g_debug_indent_level -= 1; } while(0) -# define DEBUG(ss) do{ if(debug_enabled()) { debug_output(g_debug_indent_level, __FUNCTION__) << ss << ::std::endl; } } while(0) -# define TRACE_FUNCTION TraceLog _tf_(__func__) -# define TRACE_FUNCTION_F(ss) TraceLog _tf_(__func__, [&](::std::ostream&__os){ __os << ss; }) -# define TRACE_FUNCTION_FR(ss,ss2) TraceLog _tf_(__func__, [&](::std::ostream&__os){ __os << ss; }, [&](::std::ostream&__os){ __os << ss2;}) +# define DEBUG(ss) do{ if(DEBUG_ENABLED) { debug_output(g_debug_indent_level, __FUNCTION__) << ss << ::std::endl; } } while(0) +# define TRACE_FUNCTION TraceLog _tf_( DEBUG_ENABLED ? __func__ : nullptr) +# define TRACE_FUNCTION_F(ss) TraceLog _tf_(DEBUG_ENABLED ? __func__ : nullptr, [&](::std::ostream&__os){ __os << ss; }) +# define TRACE_FUNCTION_FR(ss,ss2) TraceLog _tf_(DEBUG_ENABLED ? __func__ : nullptr, [&](::std::ostream&__os){ __os << ss; }, [&](::std::ostream&__os){ __os << ss2;}) #else # define INDENT() do { } while(0) # define UNINDENT() do {} while(0) |