[gjs/msvc.partial.fix: 1/4] [modules]/cairo-*.cpp: Forward declare specializations
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/msvc.partial.fix: 1/4] [modules]/cairo-*.cpp: Forward declare specializations
- Date: Thu, 11 Mar 2021 19:33:56 +0000 (UTC)
commit 60ae77b1d49e344a8b8e2b2a3c184e7d7f72676f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Mar 1 11:29:53 2021 +0800
[modules]/cairo-*.cpp: Forward declare specializations
This will help us avoid failing the static_assert in js/GCPolicyApi.h where
pointer types are not allowed, when building with Visual Studio, which is
caused by the compiler not picking up the needed types when js/GCPolicyAPI.h
is included in some way or the other.
modules/cairo-context.cpp | 7 +++++++
modules/cairo-gradient.cpp | 7 +++++++
modules/cairo-image-surface.cpp | 7 +++++++
modules/cairo-linear-gradient.cpp | 4 ++++
modules/cairo-path.cpp | 7 +++++++
modules/cairo-pdf-surface.cpp | 4 ++++
modules/cairo-ps-surface.cpp | 4 ++++
modules/cairo-radial-gradient.cpp | 4 ++++
modules/cairo-solid-pattern.cpp | 7 +++++++
modules/cairo-surface-pattern.cpp | 7 +++++++
modules/cairo-svg-surface.cpp | 4 ++++
11 files changed, 62 insertions(+)
---
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 696af554..f1d12b23 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -13,6 +13,7 @@
#include <js/Array.h> // for JS::NewArrayObject
#include <js/CallArgs.h>
#include <js/Conversions.h>
+#include <js/GCPolicyAPI.h>
#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
@@ -31,6 +32,12 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
#define _GJS_CAIRO_CONTEXT_GET_PRIV_CR_CHECKED(cx, argc, vp, argv, obj) \
GJS_GET_THIS(cx, argc, vp, argv, obj); \
cairo_t* cr; \
diff --git a/modules/cairo-gradient.cpp b/modules/cairo-gradient.cpp
index 07c29328..c8491ae8 100644
--- a/modules/cairo-gradient.cpp
+++ b/modules/cairo-gradient.cpp
@@ -7,6 +7,7 @@
#include <cairo.h>
#include <js/CallArgs.h>
+#include <js/GCPolicyAPI.h>
#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
@@ -19,6 +20,12 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
JSObject* CairoGradient::new_proto(JSContext* cx, JSProtoKey) {
JS::RootedObject parent_proto(cx, CairoPattern::prototype(cx));
return JS_NewObjectWithGivenProto(cx, nullptr, parent_proto);
diff --git a/modules/cairo-image-surface.cpp b/modules/cairo-image-surface.cpp
index 1ec8da4b..6bb5aefa 100644
--- a/modules/cairo-image-surface.cpp
+++ b/modules/cairo-image-surface.cpp
@@ -7,6 +7,7 @@
#include <cairo.h>
#include <js/CallArgs.h>
+#include <js/GCPolicyAPI.h>
#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
@@ -19,6 +20,12 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
JSObject* CairoImageSurface::new_proto(JSContext* cx, JSProtoKey) {
JS::RootedObject parent_proto(cx, CairoSurface::prototype(cx));
return JS_NewObjectWithGivenProto(cx, nullptr, parent_proto);
diff --git a/modules/cairo-linear-gradient.cpp b/modules/cairo-linear-gradient.cpp
index 13842396..45b8fb17 100644
--- a/modules/cairo-linear-gradient.cpp
+++ b/modules/cairo-linear-gradient.cpp
@@ -6,6 +6,7 @@
#include <cairo.h>
+#include <js/GCPolicyAPI.h>
#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
@@ -18,6 +19,9 @@
namespace JS {
class CallArgs;
+// Avoid static_assert in MSVC builds
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
}
JSObject* CairoLinearGradient::new_proto(JSContext* cx, JSProtoKey) {
diff --git a/modules/cairo-path.cpp b/modules/cairo-path.cpp
index a4a82725..3216aacb 100644
--- a/modules/cairo-path.cpp
+++ b/modules/cairo-path.cpp
@@ -8,6 +8,7 @@
#include <cairo.h>
#include <glib.h> // for g_assert
+#include <js/GCPolicyAPI.h>
#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
@@ -16,6 +17,12 @@
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
// clang-format off
const JSPropertySpec CairoPath::proto_props[] = {
JS_STRING_SYM_PS(toStringTag, "Path", JSPROP_READONLY),
diff --git a/modules/cairo-pdf-surface.cpp b/modules/cairo-pdf-surface.cpp
index 77c9d71e..add65a1c 100644
--- a/modules/cairo-pdf-surface.cpp
+++ b/modules/cairo-pdf-surface.cpp
@@ -8,6 +8,7 @@
#include <cairo-features.h> // for CAIRO_HAS_PDF_SURFACE
#include <cairo.h>
+#include <js/GCPolicyAPI.h>
#include <js/TypeDecls.h>
#include "gjs/jsapi-util.h"
@@ -26,6 +27,9 @@
namespace JS {
class CallArgs;
+// Avoid static_assert in MSVC builds
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
}
JSObject* CairoPDFSurface::new_proto(JSContext* cx, JSProtoKey) {
diff --git a/modules/cairo-ps-surface.cpp b/modules/cairo-ps-surface.cpp
index fc75774f..5da8b787 100644
--- a/modules/cairo-ps-surface.cpp
+++ b/modules/cairo-ps-surface.cpp
@@ -8,6 +8,7 @@
#include <cairo-features.h> // for CAIRO_HAS_PS_SURFACE
#include <cairo.h>
+#include <js/GCPolicyAPI.h>
#include <js/TypeDecls.h>
#include "gjs/jsapi-util.h"
@@ -26,6 +27,9 @@
namespace JS {
class CallArgs;
+// Avoid static_assert in MSVC builds
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
}
JSObject* CairoPSSurface::new_proto(JSContext* cx, JSProtoKey) {
diff --git a/modules/cairo-radial-gradient.cpp b/modules/cairo-radial-gradient.cpp
index 3f558a3d..5f2516e6 100644
--- a/modules/cairo-radial-gradient.cpp
+++ b/modules/cairo-radial-gradient.cpp
@@ -6,6 +6,7 @@
#include <cairo.h>
+#include <js/GCPolicyAPI.h>
#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
@@ -18,6 +19,9 @@
namespace JS {
class CallArgs;
+// Avoid static_assert in MSVC builds
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
}
JSObject* CairoRadialGradient::new_proto(JSContext* cx, JSProtoKey) {
diff --git a/modules/cairo-solid-pattern.cpp b/modules/cairo-solid-pattern.cpp
index cc09ab3c..664c290c 100644
--- a/modules/cairo-solid-pattern.cpp
+++ b/modules/cairo-solid-pattern.cpp
@@ -7,6 +7,7 @@
#include <cairo.h>
#include <js/CallArgs.h>
+#include <js/GCPolicyAPI.h>
#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
@@ -18,6 +19,12 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
JSObject* CairoSolidPattern::new_proto(JSContext* cx, JSProtoKey) {
JS::RootedObject parent_proto(cx, CairoPattern::prototype(cx));
return JS_NewObjectWithGivenProto(cx, nullptr, parent_proto);
diff --git a/modules/cairo-surface-pattern.cpp b/modules/cairo-surface-pattern.cpp
index a4361bbb..35557bca 100644
--- a/modules/cairo-surface-pattern.cpp
+++ b/modules/cairo-surface-pattern.cpp
@@ -7,6 +7,7 @@
#include <cairo.h>
#include <js/CallArgs.h>
+#include <js/GCPolicyAPI.h>
#include <js/PropertyDescriptor.h> // for JSPROP_READONLY
#include <js/PropertySpec.h>
#include <js/RootingAPI.h>
@@ -19,6 +20,12 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
JSObject* CairoSurfacePattern::new_proto(JSContext* cx, JSProtoKey) {
JS::RootedObject parent_proto(cx, CairoPattern::prototype(cx));
return JS_NewObjectWithGivenProto(cx, nullptr, parent_proto);
diff --git a/modules/cairo-svg-surface.cpp b/modules/cairo-svg-surface.cpp
index cb57707e..53f7e585 100644
--- a/modules/cairo-svg-surface.cpp
+++ b/modules/cairo-svg-surface.cpp
@@ -8,6 +8,7 @@
#include <cairo-features.h> // for CAIRO_HAS_SVG_SURFACE
#include <cairo.h>
+#include <js/GCPolicyAPI.h>
#include <js/TypeDecls.h>
#include "gjs/jsapi-util.h"
@@ -26,6 +27,9 @@
namespace JS {
class CallArgs;
+// Avoid static_assert in MSVC builds
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
}
JSObject* CairoSVGSurface::new_proto(JSContext* cx, JSProtoKey) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]