[gjs/wip/ptomato/warnings: 10/13] util: Provide no-op body for empty debug macros



commit c3b402d2dd88f97d3b57bcc23e44cca9f9fc617d
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.

 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]