[nemiver/count-point: 11/14] Cleanup logging macros.



commit 4039b1e2f80fdc8a6994edd9b539617188f7ac07
Author: Dodji Seketeli <dodji seketeli org>
Date:   Sun Oct 10 16:05:46 2010 +0200

    Cleanup logging macros.
    
    	* src/common/nmv-log-stream-utils.h (LOG_D, LOG_ERROR_D)
    	(LOG_VERBOSE_D): Each of these macros are now one statement
    	instead of a succession of statement separated by ';'
    	* src/dbgengine/nmv-gdbmi-parser.cc
    	(GDBMIParser::parse_local_var_list): Add a ';' at the end of
    	LOG_ERROR_D now that it's needed.

 src/common/nmv-log-stream-utils.h |   24 ++++++++++++++++++------
 src/dbgengine/nmv-gdbmi-parser.cc |    2 +-
 2 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/common/nmv-log-stream-utils.h b/src/common/nmv-log-stream-utils.h
index 8b0f2b4..80b7525 100644
--- a/src/common/nmv-log-stream-utils.h
+++ b/src/common/nmv-log-stream-utils.h
@@ -82,8 +82,12 @@ LOG_STREAM << LOG_LEVEL_NORMAL___ << LOG_MARKER_INFO << message << nemiver::comm
 #endif
 
 #ifndef LOG_D
-#define LOG_D(message, domain) \
-LOG_STREAM.push_domain (domain); LOG (message) ; LOG_STREAM.pop_domain ();
+#define LOG_D(message, domain)                  \
+    do {                                        \
+        LOG_STREAM.push_domain (domain);        \
+        LOG (message) ;                         \
+        LOG_STREAM.pop_domain ();               \
+    } while (false)
 #endif
 
 #ifndef LOG_DD
@@ -101,8 +105,12 @@ LOG_STREAM << LOG_LEVEL_NORMAL___ << LOG_MARKER_EXCEPTION << HERE << message <<
 #endif
 
 #ifndef LOG_ERROR_D
-#define LOG_ERROR_D(message, domain) \
-LOG_STREAM.push_domain (domain); LOG_ERROR (message) ; LOG_STREAM.pop_domain() ;
+#define LOG_ERROR_D(message, domain)            \
+    do {                                        \
+        LOG_STREAM.push_domain (domain);        \
+        LOG_ERROR (message) ;                   \
+        LOG_STREAM.pop_domain() ;               \
+    } while (false)
 #endif
 
 #ifndef LOG_ERROR_DD
@@ -115,8 +123,12 @@ LOG_STREAM << LOG_LEVEL_VERBOSE___ << LOG_MARKER_INFO << HERE << message << nemi
 #endif
 
 #ifndef LOG_VERBOSE_D
-#define LOG_VERBOSE_D(message) \
-LOG_STREAM.push_domain (domain); LOG_VERBOSE(message) ;LOG_STREAM.pop_domain();
+#define LOG_VERBOSE_D(message)                  \
+    do {                                        \
+        LOG_STREAM.push_domain (domain);        \
+        LOG_VERBOSE(message) ;                  \
+        LOG_STREAM.pop_domain();                \
+    } while (false)
 #endif
 
 #ifndef LOG_SCOPE_VERBOSE
diff --git a/src/dbgengine/nmv-gdbmi-parser.cc b/src/dbgengine/nmv-gdbmi-parser.cc
index 156a73e..aecfc28 100644
--- a/src/dbgengine/nmv-gdbmi-parser.cc
+++ b/src/dbgengine/nmv-gdbmi-parser.cc
@@ -2760,7 +2760,7 @@ GDBMIParser::parse_local_var_list (UString::size_type a_from,
             } else {
                 LOG_ERROR_D ("got an unknown tuple member with name: '"
                              << variable_str << "'",
-                             GDBMI_PARSING_DOMAIN)
+                             GDBMI_PARSING_DOMAIN);
                 continue;
             }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]