[gjs/wip/ptomato/mozjs38: 10/14] js: Be more pedantic about defining DEBUG



commit ad27c327eec15433261ca297c7943d638741f9fc
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Jan 10 23:11:27 2017 -0800

    js: Be more pedantic about defining DEBUG
    
    I found a bugzilla bug [1] about the situation with JS_DEBUG and DEBUG,
    and it says that DEBUG is used in some of the Mozilla headers such as
    Vector. If we don't define DEBUG every time we include a SpiderMonkey or
    Mozilla header, we could get runtime undefined behaviour depending on
    which order SpiderMonkey includes its own headers in!
    
    This consolidates all SpiderMonkey and Mozilla includes in
    jsapi-wrapper.h and adds a link to the bug in the comment so that it's
    more clear when this workaround can be removed.
    
    [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1261161
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776966

 gjs/jsapi-constructor-proxy.cpp |    9 ---------
 gjs/jsapi-util.h                |    1 -
 gjs/jsapi-wrapper.h             |    3 +++
 3 files changed, 3 insertions(+), 10 deletions(-)
---
diff --git a/gjs/jsapi-constructor-proxy.cpp b/gjs/jsapi-constructor-proxy.cpp
index d0a795d..9dab6c0 100644
--- a/gjs/jsapi-constructor-proxy.cpp
+++ b/gjs/jsapi-constructor-proxy.cpp
@@ -29,15 +29,6 @@
 #include "mem.h"
 #include "util/log.h"
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Winvalid-offsetof"
-#ifdef __clang__
-#pragma clang diagnostic ignored "-Wmismatched-tags"
-#pragma clang diagnostic ignored "-Winconsistent-missing-override"
-#endif /* __clang__ */
-#include "jsproxy.h"
-#pragma GCC diagnostic pop
-
 /* This code exposes a __private_GjsConstructorProxy function to JS, which is
  * approximately equivalent to
  *
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 7564865..8789c3b 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -27,7 +27,6 @@
 #include <stdbool.h>
 
 #include <glib-object.h>
-#include <mozilla/Maybe.h>
 
 #include "jsapi-wrapper.h"
 #include "gjs/runtime.h"
diff --git a/gjs/jsapi-wrapper.h b/gjs/jsapi-wrapper.h
index f4f57e2..37e7d71 100644
--- a/gjs/jsapi-wrapper.h
+++ b/gjs/jsapi-wrapper.h
@@ -27,6 +27,7 @@
 
 #include <js-config.h>  /* SpiderMonkey's #defines that affect public API */
 /* COMPAT: SpiderMonkey headers in some places use DEBUG instead of JS_DEBUG */
+/* https://bugzilla.mozilla.org/show_bug.cgi?id=1261161 */
 #if defined(JS_DEBUG) && JS_DEBUG
 #define DEBUG 1
 #endif
@@ -34,7 +35,9 @@
 #if defined(__clang__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 #pragma GCC system_header
 #endif
+#include <mozilla/Maybe.h>
 #include <jsapi.h>
 #include <js/OldDebugAPI.h>  /* Needed by some bits */
+#include <jsproxy.h>  /* For jsapi-constructor-proxy */
 
 #endif  /* GJS_JSAPI_WRAPPER_H */


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