[gjs/msvc.partial.fix: 18/20] [modules]/cairo-*.cpp: Forward declare specializations
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/msvc.partial.fix: 18/20] [modules]/cairo-*.cpp: Forward declare specializations
- Date: Fri, 5 Mar 2021 04:55:42 +0000 (UTC)
commit 250ef5c7b10f90cae27ab5f278706b4ad9e35781
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 | 8 ++++++++
modules/cairo-gradient.cpp | 8 ++++++++
modules/cairo-image-surface.cpp | 8 ++++++++
modules/cairo-linear-gradient.cpp | 8 ++++++++
modules/cairo-path.cpp | 8 ++++++++
modules/cairo-pdf-surface.cpp | 8 ++++++++
modules/cairo-ps-surface.cpp | 8 ++++++++
modules/cairo-radial-gradient.cpp | 8 ++++++++
modules/cairo-solid-pattern.cpp | 8 ++++++++
modules/cairo-surface-pattern.cpp | 8 ++++++++
modules/cairo-svg-surface.cpp | 8 ++++++++
11 files changed, 88 insertions(+)
---
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 696af554..76c94cf5 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -31,6 +31,14 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+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..bbba5af3 100644
--- a/modules/cairo-gradient.cpp
+++ b/modules/cairo-gradient.cpp
@@ -19,6 +19,14 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+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..ecbc2553 100644
--- a/modules/cairo-image-surface.cpp
+++ b/modules/cairo-image-surface.cpp
@@ -19,6 +19,14 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+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..70675a78 100644
--- a/modules/cairo-linear-gradient.cpp
+++ b/modules/cairo-linear-gradient.cpp
@@ -16,6 +16,14 @@
#include "gjs/jsapi-util-args.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
namespace JS {
class CallArgs;
}
diff --git a/modules/cairo-path.cpp b/modules/cairo-path.cpp
index a4a82725..cabbf8b8 100644
--- a/modules/cairo-path.cpp
+++ b/modules/cairo-path.cpp
@@ -16,6 +16,14 @@
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+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..a9403da2 100644
--- a/modules/cairo-pdf-surface.cpp
+++ b/modules/cairo-pdf-surface.cpp
@@ -24,6 +24,14 @@
# include "gjs/jsapi-util-args.h"
# include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
namespace JS {
class CallArgs;
}
diff --git a/modules/cairo-ps-surface.cpp b/modules/cairo-ps-surface.cpp
index fc75774f..798cde7f 100644
--- a/modules/cairo-ps-surface.cpp
+++ b/modules/cairo-ps-surface.cpp
@@ -24,6 +24,14 @@
# include "gjs/jsapi-util-args.h"
# include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
namespace JS {
class CallArgs;
}
diff --git a/modules/cairo-radial-gradient.cpp b/modules/cairo-radial-gradient.cpp
index 3f558a3d..bf6e9bc4 100644
--- a/modules/cairo-radial-gradient.cpp
+++ b/modules/cairo-radial-gradient.cpp
@@ -16,6 +16,14 @@
#include "gjs/jsapi-util-args.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
namespace JS {
class CallArgs;
}
diff --git a/modules/cairo-solid-pattern.cpp b/modules/cairo-solid-pattern.cpp
index cc09ab3c..0894f99a 100644
--- a/modules/cairo-solid-pattern.cpp
+++ b/modules/cairo-solid-pattern.cpp
@@ -18,6 +18,14 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+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..ec30ca85 100644
--- a/modules/cairo-surface-pattern.cpp
+++ b/modules/cairo-surface-pattern.cpp
@@ -19,6 +19,14 @@
#include "gjs/macros.h"
#include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+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..d17c806d 100644
--- a/modules/cairo-svg-surface.cpp
+++ b/modules/cairo-svg-surface.cpp
@@ -24,6 +24,14 @@
# include "gjs/jsapi-util-args.h"
# include "modules/cairo-private.h"
+// Avoid static_assert in MSVC builds
+namespace JS {
+template <typename T> struct GCPolicy;
+
+template <>
+struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
+}
+
namespace JS {
class CallArgs;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]