[Telepathy-commits] [telepathy-gabble/master] gibber-debug.h: wrap macros in parentheses/G_STMT_START as appropriate

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Feb 27 04:40:45 PST 2009


This fixes compilation of non-debug builds by making
"if (...) DEBUG (foo); else DEBUG (bar);" no longer provoke a warning.

Also remove empty definition of NODE_DEBUG in non-debug builds (it no
longer exists in debug builds).
---
 lib/gibber/gibber-debug.h |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/gibber/gibber-debug.h b/lib/gibber/gibber-debug.h
index d77b508..0c7c598 100644
--- a/lib/gibber/gibber-debug.h
+++ b/lib/gibber/gibber-debug.h
@@ -67,13 +67,17 @@ void gibber_debug_stanza (DebugFlags flag, GibberXmppStanza *stanza,
 #ifdef DEBUG_FLAG
 
 #define DEBUG(format, ...) \
-  gibber_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
+  G_STMT_START { \
+  gibber_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__); \
+  } G_STMT_END
 
 #define DEBUG_STANZA(stanza, format, ...) \
+  G_STMT_START { \
   gibber_debug_stanza (DEBUG_FLAG, stanza, "%s: " format, G_STRFUNC,\
-      ##__VA_ARGS__)
+      ##__VA_ARGS__); \
+  } G_STMT_END
 
-#define DEBUGGING debug_flag_is_set(DEBUG_FLAG)
+#define DEBUGGING (debug_flag_is_set (DEBUG_FLAG))
 
 #endif /* DEBUG_FLAG */
 
@@ -81,13 +85,11 @@ void gibber_debug_stanza (DebugFlags flag, GibberXmppStanza *stanza,
 
 #ifdef DEBUG_FLAG
 
-#define DEBUG(format, ...)
+#define DEBUG(format, ...) G_STMT_START { } G_STMT_END
 
-#define DEBUG_STANZA(stanza, format, ...)
+#define DEBUG_STANZA(stanza, format, ...) G_STMT_START { } G_STMT_END
 
-#define DEBUGGING 0
-
-#define NODE_DEBUG(n, s)
+#define DEBUGGING (0)
 
 #endif /* DEBUG_FLAG */
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list