util: move DB() debug macro from app
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Thu, 27 Jul 2017 13:49:50 +0000 (15:49 +0200)
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 8 Aug 2017 15:24:00 +0000 (17:24 +0200)
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
src/app.cpp
src/util.hpp

index 606c167..9bd12ed 100644 (file)
 
 namespace wm {
 
-#ifndef NDEBUG
-#define DB(expr)                                                           \
-   do {                                                                    \
-      std::ostringstream o;                                                \
-      o << __FILE__ << ":" << __LINE__ << ":" << __func__ << ": " << expr; \
-      logdebug(o.str().c_str());                                           \
-   } while (0)
-#else
-#define DB(expr)
-#endif
-
 namespace {
 App *g_app;
 
index 84c2462..e285c0f 100644 (file)
@@ -33,6 +33,18 @@ extern "C" {
 #define logdebug(...)
 #endif
 
+#ifndef NDEBUG
+#define DB(expr)                                                           \
+   do {                                                                    \
+      std::ostringstream o;                                                \
+      o << __FILE__ << ":" << __LINE__ << ":" << __func__ << ": " << expr; \
+      logdebug("%s", o.str().c_str());                                           \
+   } while (0)
+#else
+#define DB(expr)
+#endif
+
+
 //      _                   _                 _                       __     _
 //  ___| |_ _ __ _   _  ___| |_   _   _ _ __ (_) __ _ _   _  ___     / _| __| |
 // / __| __| '__| | | |/ __| __| | | | | '_ \| |/ _` | | | |/ _ \   | |_ / _` |