[gjs] util: Provide no-op body for empty debug macros



commit 882a8da5f6177c199419b14f1241875c7c69bcba
Author: Philip Chimento <philip endlessm com>
Date:   Mon Oct 3 14:13:26 2016 -0700

    util: Provide no-op body for empty debug macros
    
    In the case where debug macros are disabled, we provide a no-op body.
    This allows you to do things like
    
    if (condition)
        gjs_debug_something("message");
    
    without the compiler thinking you are doing this
    
    if (condition);
    
    which it would flag as a warning.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773297

 util/log.h |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/util/log.h b/util/log.h
index 2a9b596..dc8228b 100644
--- a/util/log.h
+++ b/util/log.h
@@ -114,42 +114,42 @@ typedef enum {
 #define gjs_debug_jsprop(topic, format...) \
     do { gjs_debug(topic, format); } while(0)
 #else
-#define gjs_debug_jsprop(topic, format...)
+#define gjs_debug_jsprop(topic, format...) ((void)0)
 #endif
 
 #if GJS_VERBOSE_ENABLE_MARSHAL
 #define gjs_debug_marshal(topic, format...) \
     do { gjs_debug(topic, format); } while(0)
 #else
-#define gjs_debug_marshal(topic, format...)
+#define gjs_debug_marshal(topic, format...) ((void)0)
 #endif
 
 #if GJS_VERBOSE_ENABLE_LIFECYCLE
 #define gjs_debug_lifecycle(topic, format...) \
     do { gjs_debug(topic, format); } while(0)
 #else
-#define gjs_debug_lifecycle(topic, format...)
+#define gjs_debug_lifecycle(topic, format...) ((void)0)
 #endif
 
 #if GJS_VERBOSE_ENABLE_GI_USAGE
 #define gjs_debug_gi_usage(format...) \
     do { gjs_debug(GJS_DEBUG_GI_USAGE, format); } while(0)
 #else
-#define gjs_debug_gi_usage(format...)
+#define gjs_debug_gi_usage(format...) ((void)0)
 #endif
 
 #if GJS_VERBOSE_ENABLE_GCLOSURE
 #define gjs_debug_closure(format...) \
     do { gjs_debug(GJS_DEBUG_GCLOSURE, format); } while(0)
 #else
-#define gjs_debug_closure(format, ...)
+#define gjs_debug_closure(format, ...) ((void)0)
 #endif
 
 #if GJS_VERBOSE_ENABLE_GSIGNAL
 #define gjs_debug_gsignal(format...) \
     do { gjs_debug(GJS_DEBUG_GOBJECT, format); } while(0)
 #else
-#define gjs_debug_gsignal(format...)
+#define gjs_debug_gsignal(format...) ((void)0)
 #endif
 
 void gjs_debug(GjsDebugTopic topic,


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