From dc9481973d27444582bae8bd342056b8d5c77376 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 16 Mar 2021 19:30:57 +0100 Subject: [PATCH] core: Drop "volatile" from static GTypes in manual registration As documented in g_once_init_enter(): "While @location has a volatile qualifier, this is a historical artifact and the pointer passed to it should not be volatile.". And effectively this now warns with modern glibc. Drop the "volatile" qualifier from these static variables as it's expected. Part-of: --- src/meta-private-enum-types.c.in | 13 ++++++------- src/meta/meta-enum-types.c.in | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/meta-private-enum-types.c.in b/src/meta-private-enum-types.c.in index 55d323e45..c2479a91a 100644 --- a/src/meta-private-enum-types.c.in +++ b/src/meta-private-enum-types.c.in @@ -13,9 +13,9 @@ GType @enum_name@_get_type (void) { - static volatile gsize g_enum_type_id__volatile = 0; + static size_t g_enum_type_id = 0; - if (g_once_init_enter (&g_enum_type_id__volatile)) + if (g_once_init_enter (&g_enum_type_id)) { static const G@Type@Value values[] = { /*** END value-header ***/ @@ -27,14 +27,13 @@ GType /*** BEGIN value-tail ***/ { 0, NULL, NULL } }; - GType g_enum_type_id; + GType id; - g_enum_type_id = - g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); - g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id); + g_once_init_leave (&g_enum_type_id, id); } - return g_enum_type_id__volatile; + return g_enum_type_id; } /*** END value-tail ***/ diff --git a/src/meta/meta-enum-types.c.in b/src/meta/meta-enum-types.c.in index 0480ffdca..a5d839141 100644 --- a/src/meta/meta-enum-types.c.in +++ b/src/meta/meta-enum-types.c.in @@ -13,9 +13,9 @@ GType @enum_name@_get_type (void) { - static volatile gsize g_enum_type_id__volatile = 0; + static size_t g_enum_type_id = 0; - if (g_once_init_enter (&g_enum_type_id__volatile)) + if (g_once_init_enter (&g_enum_type_id)) { static const G@Type@Value values[] = { /*** END value-header ***/ @@ -27,14 +27,13 @@ GType /*** BEGIN value-tail ***/ { 0, NULL, NULL } }; - GType g_enum_type_id; + GType id; - g_enum_type_id = - g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); - g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id); + g_once_init_leave (&g_enum_type_id, id); } - return g_enum_type_id__volatile; + return g_enum_type_id; } /*** END value-tail ***/