From: Marcus Fritzsch Date: Thu, 31 Aug 2017 12:49:15 +0000 (+0200) Subject: AFBClient: fix NDEBUG usage X-Git-Tag: 4.99.1~52 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging%2Fwindowmanager.git;a=commitdiff_plain;h=2624def304610c4111d11ca529e1e8433ede453e AFBClient: fix NDEBUG usage Signed-off-by: Marcus Fritzsch --- 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 */