[gjs/wip/ptomato/windows: 2/2] Header: Avoid GCCisms
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/windows: 2/2] Header: Avoid GCCisms
- Date: Fri, 20 Jan 2017 07:40:08 +0000 (UTC)
commit 366aa43fda5d1ea69c687b6ead706618022b47af
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Jan 16 15:43:32 2017 +0800
Header: Avoid GCCisms
Use ISO-style vararg syntax for the logging items so that things will
work on non-GCC, and use G_GNUC_UNUSED in place of __attribute__((unused)),
which achives the same purpose when GCC is used, and expands to
nothing otherwise.
https://bugzilla.gnome.org/show_bug.cgi?id=775868
gjs/jsapi-util.h | 4 ++--
util/log.h | 36 ++++++++++++++++++------------------
2 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 78cc4a9..c26e40f 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -76,7 +76,7 @@ typedef struct GjsRootedArray GjsRootedArray;
* do_base_typecheck and priv_from_js
*/
#define GJS_DEFINE_PRIV_FROM_JS(type, klass) \
- __attribute__((unused)) static inline bool \
+ G_GNUC_UNUSED static inline bool \
do_base_typecheck(JSContext *context, \
JS::HandleObject object, \
bool throw_error) \
@@ -93,7 +93,7 @@ typedef struct GjsRootedArray GjsRootedArray;
JS_EndRequest(context); \
return priv; \
} \
- __attribute__((unused)) static bool \
+ G_GNUC_UNUSED static bool \
priv_from_js_with_typecheck(JSContext *context, \
JS::HandleObject object, \
type **out) \
diff --git a/util/log.h b/util/log.h
index 7adf466..98a790c 100644
--- a/util/log.h
+++ b/util/log.h
@@ -112,45 +112,45 @@ typedef enum {
#endif
#if GJS_VERBOSE_ENABLE_PROPS
-#define gjs_debug_jsprop(topic, format...) \
- do { gjs_debug(topic, format); } while(0)
+#define gjs_debug_jsprop(topic, ...) \
+ do { gjs_debug(topic, __VA_ARGS__); } while(0)
#else
-#define gjs_debug_jsprop(topic, format...) ((void)0)
+#define gjs_debug_jsprop(topic, ...) ((void)0)
#endif
#if GJS_VERBOSE_ENABLE_MARSHAL
-#define gjs_debug_marshal(topic, format...) \
- do { gjs_debug(topic, format); } while(0)
+#define gjs_debug_marshal(topic, ...) \
+ do { gjs_debug(topic, __VA_ARGS__); } while(0)
#else
-#define gjs_debug_marshal(topic, format...) ((void)0)
+#define gjs_debug_marshal(topic, ...) ((void)0)
#endif
#if GJS_VERBOSE_ENABLE_LIFECYCLE
-#define gjs_debug_lifecycle(topic, format...) \
- do { gjs_debug(topic, format); } while(0)
+#define gjs_debug_lifecycle(topic, ...) \
+ do { gjs_debug(topic, __VA_ARGS__); } while(0)
#else
-#define gjs_debug_lifecycle(topic, format...) ((void)0)
+#define gjs_debug_lifecycle(topic, ...) ((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)
+#define gjs_debug_gi_usage(...) \
+ do { gjs_debug(GJS_DEBUG_GI_USAGE, __VA_ARGS__); } while(0)
#else
-#define gjs_debug_gi_usage(format...) ((void)0)
+#define gjs_debug_gi_usage(...) ((void)0)
#endif
#if GJS_VERBOSE_ENABLE_GCLOSURE
-#define gjs_debug_closure(format...) \
- do { gjs_debug(GJS_DEBUG_GCLOSURE, format); } while(0)
+#define gjs_debug_closure(...) \
+ do { gjs_debug(GJS_DEBUG_GCLOSURE, __VA_ARGS__); } while(0)
#else
-#define gjs_debug_closure(format, ...) ((void)0)
+#define gjs_debug_closure(...) ((void)0)
#endif
#if GJS_VERBOSE_ENABLE_GSIGNAL
-#define gjs_debug_gsignal(format...) \
- do { gjs_debug(GJS_DEBUG_GOBJECT, format); } while(0)
+#define gjs_debug_gsignal(...) \
+ do { gjs_debug(GJS_DEBUG_GOBJECT, __VA_ARGS__); } while(0)
#else
-#define gjs_debug_gsignal(format...) ((void)0)
+#define gjs_debug_gsignal(...) ((void)0)
#endif
void gjs_debug(GjsDebugTopic topic,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]