clutter: 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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1785>
This commit is contained in:
Carlos Garnacho 2021-03-16 19:30:37 +01:00 committed by Marge Bot
parent 9e10d2fa88
commit bc1026d52d
3 changed files with 16 additions and 17 deletions

View File

@ -14,9 +14,9 @@
GType GType
@enum_name@_get_type (void) @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[] = { static const G@Type@Value values[] = {
/*** END value-header ***/ /*** END value-header ***/
@ -28,14 +28,13 @@ GType
/*** BEGIN value-tail ***/ /*** BEGIN value-tail ***/
{ 0, NULL, NULL } { 0, NULL, NULL }
}; };
GType g_enum_type_id; GType id;
g_enum_type_id = id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
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 ***/ /*** END value-tail ***/

View File

@ -234,9 +234,9 @@ clutter_paint_node_init (ClutterPaintNode *self)
GType GType
clutter_paint_node_get_type (void) clutter_paint_node_get_type (void)
{ {
static volatile gsize paint_node_type_id__volatile = 0; static size_t paint_node_type_id = 0;
if (g_once_init_enter (&paint_node_type_id__volatile)) if (g_once_init_enter (&paint_node_type_id))
{ {
static const GTypeFundamentalInfo finfo = { static const GTypeFundamentalInfo finfo = {
(G_TYPE_FLAG_CLASSED | (G_TYPE_FLAG_CLASSED |
@ -272,16 +272,16 @@ clutter_paint_node_get_type (void)
&value_table, &value_table,
}; };
GType paint_node_type_id = GType id =
g_type_register_fundamental (g_type_fundamental_next (), g_type_register_fundamental (g_type_fundamental_next (),
I_("ClutterPaintNode"), I_("ClutterPaintNode"),
&node_info, &finfo, &node_info, &finfo,
G_TYPE_FLAG_ABSTRACT); G_TYPE_FLAG_ABSTRACT);
g_once_init_leave (&paint_node_type_id__volatile, paint_node_type_id); g_once_init_leave (&paint_node_type_id, id);
} }
return paint_node_type_id__volatile; return paint_node_type_id;
} }
/** /**

View File

@ -57,9 +57,9 @@ G_DEFINE_TYPE (ClutterBackendX11, clutter_backend_x11, CLUTTER_TYPE_BACKEND)
GType GType
clutter_x11_filter_return_get_type (void) clutter_x11_filter_return_get_type (void)
{ {
static volatile gsize g_define_type__volatile; static size_t g_define_type;
if (g_once_init_enter (&g_define_type__volatile)) if (g_once_init_enter (&g_define_type))
{ {
static const GEnumValue values[] = { static const GEnumValue values[] = {
{ CLUTTER_X11_FILTER_CONTINUE, "CLUTTER_X11_FILTER_CONTINUE", "continue" }, { CLUTTER_X11_FILTER_CONTINUE, "CLUTTER_X11_FILTER_CONTINUE", "continue" },
@ -68,13 +68,13 @@ clutter_x11_filter_return_get_type (void)
{ 0, NULL, NULL }, { 0, NULL, NULL },
}; };
GType g_define_type = GType id =
g_enum_register_static (g_intern_static_string ("ClutterX11FilterReturn"), values); g_enum_register_static (g_intern_static_string ("ClutterX11FilterReturn"), values);
g_once_init_leave (&g_define_type__volatile, g_define_type); g_once_init_leave (&g_define_type, id);
} }
return g_define_type__volatile; return g_define_type;
} }
/* atoms; remember to add the code that assigns the atom value to /* atoms; remember to add the code that assigns the atom value to