diff options
| -rw-r--r-- | meta-gnome/recipes-gnome/gjs/gjs/0001-maint-Avoid-g_once_init_enter-error-in-GCC-11.patch | 77 | ||||
| -rw-r--r-- | meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb | 4 |
2 files changed, 80 insertions, 1 deletions
diff --git a/meta-gnome/recipes-gnome/gjs/gjs/0001-maint-Avoid-g_once_init_enter-error-in-GCC-11.patch b/meta-gnome/recipes-gnome/gjs/gjs/0001-maint-Avoid-g_once_init_enter-error-in-GCC-11.patch new file mode 100644 index 0000000000..6343a24a2d --- /dev/null +++ b/meta-gnome/recipes-gnome/gjs/gjs/0001-maint-Avoid-g_once_init_enter-error-in-GCC-11.patch | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | From dae0055be61937fe70252f3f4ee09b355aba2b8f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Philip Chimento <philip.chimento@gmail.com> | ||
| 3 | Date: Sun, 14 Feb 2021 12:20:09 -0800 | ||
| 4 | Subject: [PATCH] maint: Avoid g_once_init_enter error in GCC 11 | ||
| 5 | |||
| 6 | On platforms where g_once_init_enter() is defined to use C11 atomic | ||
| 7 | builtins, passing a pointer to a volatile value is an error in GCC 11 and | ||
| 8 | later, in C++. | ||
| 9 | |||
| 10 | More info about the GCC change: | ||
| 11 | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95378 | ||
| 12 | https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548283.html | ||
| 13 | |||
| 14 | However, it's my understanding that in modern C++ there is no longer a | ||
| 15 | need to guard the initialization of these variables. Since C++11, static | ||
| 16 | local variables in a function are guaranteed to be initialized only once, | ||
| 17 | the first time control passes through that function. So we can just remove | ||
| 18 | the g_once_init_enter guard. | ||
| 19 | |||
| 20 | More info: | ||
| 21 | https://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables | ||
| 22 | |||
| 23 | Stack Overflow answers with quotations from the C++ standard: | ||
| 24 | https://stackoverflow.com/a/58804/172999 | ||
| 25 | https://stackoverflow.com/a/8102145/172999 | ||
| 26 | |||
| 27 | Closes: #376 | ||
| 28 | --- | ||
| 29 | gjs/error-types.cpp | 32 +++++++++++++------------------- | ||
| 30 | 1 file changed, 13 insertions(+), 19 deletions(-) | ||
| 31 | |||
| 32 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gjs/-/commit/f02eaf3a9d3465915eb849428c2d9615e2184a4c] | ||
| 33 | diff --git a/gjs/error-types.cpp b/gjs/error-types.cpp | ||
| 34 | index 86cb878..5eba61b 100644 | ||
| 35 | --- a/gjs/error-types.cpp | ||
| 36 | +++ b/gjs/error-types.cpp | ||
| 37 | @@ -31,24 +31,18 @@ G_DEFINE_QUARK(gjs-js-error-quark, gjs_js_error) | ||
| 38 | // clang-format on | ||
| 39 | |||
| 40 | GType gjs_js_error_get_type(void) { | ||
| 41 | - static volatile GType g_type_id; | ||
| 42 | - | ||
| 43 | - if (g_once_init_enter(&g_type_id)) { | ||
| 44 | - static GEnumValue errors[] = { | ||
| 45 | - { GJS_JS_ERROR_ERROR, "Error", "error" }, | ||
| 46 | - { GJS_JS_ERROR_EVAL_ERROR, "EvalError", "eval-error" }, | ||
| 47 | - { GJS_JS_ERROR_INTERNAL_ERROR, "InternalError", "internal-error" }, | ||
| 48 | - { GJS_JS_ERROR_RANGE_ERROR, "RangeError", "range-error" }, | ||
| 49 | - { GJS_JS_ERROR_REFERENCE_ERROR, "ReferenceError", "reference-error" }, | ||
| 50 | - { GJS_JS_ERROR_STOP_ITERATION, "StopIteration", "stop-iteration" }, | ||
| 51 | - { GJS_JS_ERROR_SYNTAX_ERROR, "SyntaxError", "syntax-error" }, | ||
| 52 | - { GJS_JS_ERROR_TYPE_ERROR, "TypeError", "type-error" }, | ||
| 53 | - { GJS_JS_ERROR_URI_ERROR, "URIError", "uri-error" }, | ||
| 54 | - { 0, nullptr, nullptr } | ||
| 55 | - }; | ||
| 56 | - | ||
| 57 | - g_type_id = g_enum_register_static("GjsJSError", errors); | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | + static const GEnumValue errors[] = { | ||
| 61 | + {GJS_JS_ERROR_ERROR, "Error", "error"}, | ||
| 62 | + {GJS_JS_ERROR_EVAL_ERROR, "EvalError", "eval-error"}, | ||
| 63 | + {GJS_JS_ERROR_INTERNAL_ERROR, "InternalError", "internal-error"}, | ||
| 64 | + {GJS_JS_ERROR_RANGE_ERROR, "RangeError", "range-error"}, | ||
| 65 | + {GJS_JS_ERROR_REFERENCE_ERROR, "ReferenceError", "reference-error"}, | ||
| 66 | + {GJS_JS_ERROR_STOP_ITERATION, "StopIteration", "stop-iteration"}, | ||
| 67 | + {GJS_JS_ERROR_SYNTAX_ERROR, "SyntaxError", "syntax-error"}, | ||
| 68 | + {GJS_JS_ERROR_TYPE_ERROR, "TypeError", "type-error"}, | ||
| 69 | + {GJS_JS_ERROR_URI_ERROR, "URIError", "uri-error"}, | ||
| 70 | + {0, nullptr, nullptr}}; | ||
| 71 | + // Initialization of static local variable guaranteed only once in C++11 | ||
| 72 | + static GType g_type_id = g_enum_register_static("GjsJSError", errors); | ||
| 73 | return g_type_id; | ||
| 74 | } | ||
| 75 | -- | ||
| 76 | 2.31.1 | ||
| 77 | |||
diff --git a/meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb b/meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb index dbb04ef8e3..678ba9c4c8 100644 --- a/meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb +++ b/meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb | |||
| @@ -12,7 +12,9 @@ DEPENDS = "mozjs gtk+3" | |||
| 12 | inherit gnomebase gsettings gobject-introspection vala gettext features_check upstream-version-is-even | 12 | inherit gnomebase gsettings gobject-introspection vala gettext features_check upstream-version-is-even |
| 13 | 13 | ||
| 14 | SRC_URI[archive.sha256sum] = "7fb3eb746c17363d9ee47f4a5d0bb048f0075611763eb0da11d85e0e57aff381" | 14 | SRC_URI[archive.sha256sum] = "7fb3eb746c17363d9ee47f4a5d0bb048f0075611763eb0da11d85e0e57aff381" |
| 15 | SRC_URI += "file://0001-Disable-tests-on-host.patch" | 15 | SRC_URI += "file://0001-Disable-tests-on-host.patch \ |
| 16 | file://0001-maint-Avoid-g_once_init_enter-error-in-GCC-11.patch \ | ||
| 17 | " | ||
| 16 | 18 | ||
| 17 | # gobject-introspection is mandatory and cannot be configured | 19 | # gobject-introspection is mandatory and cannot be configured |
| 18 | REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" | 20 | REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" |
