[gnome-continuous] Try out a patch for GJS



commit 4e3ac53c31cbb3d05646ebf12999c87cfa544ef5
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu May 30 12:12:40 2019 +0100

    Try out a patch for GJS
    
    Should fix: https://gitlab.gnome.org/GNOME/gjs/issues/253

 manifest.json           |  3 ++-
 patches/gjs-error.patch | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 1 deletion(-)
---
diff --git a/manifest.json b/manifest.json
index 03a4157..b2ba034 100644
--- a/manifest.json
+++ b/manifest.json
@@ -967,7 +967,8 @@
                  "name": "zenity"},
 
                {"src": "gnome:gjs.git",
-                 "name": "gjs"},
+                 "name": "gjs",
+                 "patches": ["gjs-error.patch"]},
 
                {"src": "git:https://github.com/ostreedev/ostree";,
                  "patches": ["ostree-gpg-error-config.patch"],
diff --git a/patches/gjs-error.patch b/patches/gjs-error.patch
new file mode 100644
index 0000000..9490f85
--- /dev/null
+++ b/patches/gjs-error.patch
@@ -0,0 +1,68 @@
+From a6bb10a75a4713c996b6d43e99cd963d2298100a Mon Sep 17 00:00:00 2001
+From: Philip Chimento <philip chimento gmail com>
+Date: Wed, 29 May 2019 17:33:06 -0700
+Subject: [PATCH] wrapperutils: Fix compiler warning on GCC 5.x
+
+We had a cast to void* which suppressed this warning on later versions
+of GCC, but that doesn't work on GCC 5.x. While researching the warning
+I read advice to not mix static template programming with dynamic
+template programming. In C++17 we could solve this statically with "if
+constexpr", but we only require C++14, so the best option is to change
+the whole thing to dynamic, providing a no_type_struct() function for
+the template specializations that don't have a GType struct.
+
+Closes: #253.
+---
+ gi/wrapperutils.cpp | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/gi/wrapperutils.cpp b/gi/wrapperutils.cpp
+index cdd97df9..82ff4632 100644
+--- a/gi/wrapperutils.cpp
++++ b/gi/wrapperutils.cpp
+@@ -105,6 +105,8 @@ bool gjs_wrapper_define_gtype_prop(JSContext* cx, JS::HandleObject constructor,
+ template <InfoType::Tag TAG>
+ struct InfoMethodsPolicy {};
+ 
++static GIStructInfo* no_type_struct(GIBaseInfo*) { return nullptr; }
++
+ #define DECLARE_POLICY(tag, type, type_struct_func)                            \
+     template <>                                                                \
+     struct InfoMethodsPolicy<InfoType::tag> {                                  \
+@@ -115,10 +117,10 @@ struct InfoMethodsPolicy {};
+         static constexpr GIStructInfo* (*type_struct)(T*) = type_struct_func;  \
+     };
+ 
+-DECLARE_POLICY(Enum, enum, nullptr)
++DECLARE_POLICY(Enum, enum, no_type_struct)
+ DECLARE_POLICY(Interface, interface, g_interface_info_get_iface_struct)
+ DECLARE_POLICY(Object, object, g_object_info_get_class_struct)
+-DECLARE_POLICY(Struct, struct, nullptr)
++DECLARE_POLICY(Struct, struct, no_type_struct)
+ 
+ #undef DECLARE_POLICY
+ 
+@@ -143,16 +145,14 @@ bool gjs_define_static_methods(JSContext* cx, JS::HandleObject constructor,
+         }
+     }
+ 
+-    // Casting to void* avoids warning that the function pointer will never be
+-    // null in template instantiations where it is not null
+-    if (!reinterpret_cast<void*>(InfoMethodsPolicy<TAG>::type_struct))
+-        return true;
+-
+     // Also define class/interface methods if there is a gtype struct
+ 
+     GjsAutoStructInfo type_struct = InfoMethodsPolicy<TAG>::type_struct(info);
++    // Not an error for it to be null even in the case of Object and Interface;
++    // documentation says g_object_info_get_class_struct() and
++    // g_interface_info_get_iface_struct() can validly return a null pointer.
+     if (!type_struct)
+-        return true;  // not an error?
++        return true;
+ 
+     n_methods = g_struct_info_get_n_methods(type_struct);
+ 
+-- 
+2.21.0
+


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