summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-31 14:49:15 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-14 14:04:51 +0200
commit2624def304610c4111d11ca529e1e8433ede453e (patch)
treee9a65f392ee701def1b1c263d1aa2c292332310a
parenta03087dcce0dfbd993058614e9becd34605d81a3 (diff)
AFBClient: fix NDEBUG usage
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r--AFBClient.cpp25
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 */