[Telepathy-commits] [telepathy-salut/master] Define stub DEBUG macros when !ENABLE_DEBUG

Will Thompson will.thompson at collabora.co.uk
Sun Jan 11 09:50:48 PST 2009


Defining DEBUG(...) to expand to nothing trips warnings for code like
this:

  if (foo)
    DEBUG(...);

It could be worked around by using {}s, but better to fix the macros
---
 lib/gibber/gibber-debug.h |    9 ++++++---
 src/debug.h               |    6 ++++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/gibber/gibber-debug.h b/lib/gibber/gibber-debug.h
index 2aafd68..9cd9f1b 100644
--- a/lib/gibber/gibber-debug.h
+++ b/lib/gibber/gibber-debug.h
@@ -55,13 +55,16 @@ 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 NODE_DEBUG(n, s) \
+  G_STMT_START { } G_STMT_END
 
 #endif /* DEBUG_FLAG */
 
diff --git a/src/debug.h b/src/debug.h
index b3dd5ce..0d80cd8 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -52,11 +52,13 @@ void debug (DebugFlags flag, const gchar *format, ...)
 
 #ifdef DEBUG_FLAG
 
-#define DEBUG(format, ...)
+#define DEBUG(format, ...) \
+  G_STMT_START { } G_STMT_END
 
 #define DEBUGGING 0
 
-#define NODE_DEBUG(n, s)
+#define NODE_DEBUG(n, s) \
+  G_STMT_START { } G_STMT_END
 
 #endif /* DEBUG_FLAG */
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list