diff options
Diffstat (limited to 'AFBClient.cpp')
-rw-r--r-- | AFBClient.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/AFBClient.cpp b/AFBClient.cpp index 328445c..d63b8c1 100644 --- a/AFBClient.cpp +++ b/AFBClient.cpp @@ -14,22 +14,21 @@ namespace { constexpr const int token_maxlen = 20; constexpr const char *const wmAPI = "winman"; +#ifdef NDEBUG +#define TRACE() +#else +#define TRACE() \ + ScopeTrace __attribute__((unused)) trace_scope_here__(__PRETTY_FUNCTION__) + struct ScopeTrace { - static int indent; - char const *f{}; - ScopeTrace(char const *func) : f(func) { - fprintf(stderr, "%*s%s -->\n", 2 * indent++, "", this->f); - } - ~ScopeTrace() { - fprintf(stderr, "%*s%s <--\n", 2 * --indent, "", this->f); - } + static int indent; + char const *f{}; + ScopeTrace(char const *func) : f(func) { + fprintf(stderr, "%*s%s -->\n", 2 * indent++, "", this->f); + } + ~ScopeTrace() { fprintf(stderr, "%*s%s <--\n", 2 * --indent, "", this->f); } }; int ScopeTrace::indent = 0; - -#ifndef NDEBUG -#define TRACE() -#else -#define TRACE() ScopeTrace __attribute__((unused)) trace_scope_here__(__PRETTY_FUNCTION__) #endif /* called when wsj1 receives a method invocation */ |