[gjs: 2/4] GjsPrivate: Remove volatile from g_once_init_enter flag




commit 989ac9ac723dc1c8b6b8961292f236c558f5c0f0
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Feb 15 20:40:43 2021 -0800

    GjsPrivate: Remove volatile from g_once_init_enter flag
    
    On platforms where g_once_init_enter() is defined to use C11 atomic
    builtins, passing a pointer to a volatile value will generate a warning
    in GCC 11 and later.
    
    More info about the GCC change:
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95378
    https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548283.html
    
    More info about changes made in GLib:
    https://gitlab.gnome.org/GNOME/glib/-/issues/600
    
    See: #376

 libgjs-private/gjs-util.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/libgjs-private/gjs-util.c b/libgjs-private/gjs-util.c
index 88a575b9..4fd268cd 100644
--- a/libgjs-private/gjs-util.c
+++ b/libgjs-private/gjs-util.c
@@ -37,8 +37,8 @@ gjs_format_int_alternative_output(int n)
 }
 
 GType gjs_locale_category_get_type(void) {
-    static volatile size_t g_define_type_id__volatile = 0;
-    if (g_once_init_enter(&g_define_type_id__volatile)) {
+    static size_t gjs_locale_category_get_type = 0;
+    if (g_once_init_enter(&gjs_locale_category_get_type)) {
         static const GEnumValue v[] = {
             {GJS_LOCALE_CATEGORY_ALL, "GJS_LOCALE_CATEGORY_ALL", "all"},
             {GJS_LOCALE_CATEGORY_COLLATE, "GJS_LOCALE_CATEGORY_COLLATE",
@@ -55,9 +55,9 @@ GType gjs_locale_category_get_type(void) {
         GType g_define_type_id = g_enum_register_static(
             g_intern_static_string("GjsLocaleCategory"), v);
 
-        g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
+        g_once_init_leave(&gjs_locale_category_get_type, g_define_type_id);
     }
-    return g_define_type_id__volatile;
+    return gjs_locale_category_get_type;
 }
 
 /**


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