From 0d2ea14ac1d0b59588b1bfa60e6e45246496572c Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 18 Nov 2020 19:58:09 -0800 Subject: [PATCH] types: fix various use of volatile in type registration The use of volatile was incorrect in GLib and has been that way for a long time. Recently however that has changed, and this makes GTK follow suit to avoid using volatile in the type registration. See also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719 Combined with the above merge request for GLib, this fixes a large number of compilation warnings when using Clang. --- gdk/gdkenumtypes.c.template | 2 +- gdk/gdkevents.c | 6 +++--- gsk/gskdebug.c | 2 +- gsk/gskenumtypes.c.template | 2 +- gsk/gskrendernode.c | 2 +- gsk/gskrendernodeimpl.c | 2 +- gtk/css/gtkcssenumtypes.c.template | 2 +- gtk/gtkexpression.c | 6 +++--- gtk/gtkprintoperation-win32.c | 2 +- gtk/gtkprivatetypebuiltins.c.template | 2 +- gtk/gtktypebuiltins.c.template | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gdk/gdkenumtypes.c.template b/gdk/gdkenumtypes.c.template index c5104e0e0d..768210a839 100644 --- a/gdk/gdkenumtypes.c.template +++ b/gdk/gdkenumtypes.c.template @@ -12,7 +12,7 @@ GType @enum_name@_get_type (void) { - static volatile gsize g_define_type_id__volatile = 0; + static gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 9cfefd0d39..100fc7ba9e 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -210,7 +210,7 @@ gdk_event_init (GdkEvent *self) GType gdk_event_get_type (void) { - static volatile gsize event_type__volatile; + static gsize event_type__volatile; if (g_once_init_enter (&event_type__volatile)) { @@ -374,7 +374,7 @@ static GType gdk_event_types[GDK_EVENT_LAST]; GType \ type_name ## _get_type (void) \ { \ - static volatile gsize gdk_define_event_type_id__volatile; \ + static gsize gdk_define_event_type_id__volatile; \ if (g_once_init_enter (&gdk_define_event_type_id__volatile)) \ { \ GType gdk_define_event_type_id = \ @@ -453,7 +453,7 @@ gdk_event_init_types_once (void) void gdk_event_init_types (void) { - static volatile gsize event_types__volatile; + static gsize event_types__volatile; if (g_once_init_enter (&event_types__volatile)) { diff --git a/gsk/gskdebug.c b/gsk/gskdebug.c index 4e197257ef..83a3619fe7 100644 --- a/gsk/gskdebug.c +++ b/gsk/gskdebug.c @@ -22,7 +22,7 @@ static guint gsk_debug_flags; static void init_debug_flags (void) { - static volatile gsize gsk_debug_flags__set; + static gsize gsk_debug_flags__set; if (g_once_init_enter (&gsk_debug_flags__set)) { diff --git a/gsk/gskenumtypes.c.template b/gsk/gskenumtypes.c.template index 5aa13fe70e..ae1d0de501 100644 --- a/gsk/gskenumtypes.c.template +++ b/gsk/gskenumtypes.c.template @@ -13,7 +13,7 @@ GType @enum_name@_get_type (void) { - static volatile gsize g_define_type_id__volatile = 0; + static gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c index 92dfc77e2f..f0980ba369 100644 --- a/gsk/gskrendernode.c +++ b/gsk/gskrendernode.c @@ -184,7 +184,7 @@ gsk_render_node_init (GskRenderNode *self) GType gsk_render_node_get_type (void) { - static volatile gsize render_node_type__volatile; + static gsize render_node_type__volatile; if (g_once_init_enter (&render_node_type__volatile)) { diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index e5228d88c9..da3c130110 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -5165,7 +5165,7 @@ gsk_render_node_init_types_once (void) void gsk_render_node_init_types (void) { - static volatile gsize register_types__volatile; + static gsize register_types__volatile; if (g_once_init_enter (®ister_types__volatile)) { diff --git a/gtk/css/gtkcssenumtypes.c.template b/gtk/css/gtkcssenumtypes.c.template index 063b8d0d3f..cb4c9ac217 100644 --- a/gtk/css/gtkcssenumtypes.c.template +++ b/gtk/css/gtkcssenumtypes.c.template @@ -13,7 +13,7 @@ GType @enum_name@_get_type (void) { - static volatile gsize g_define_type_id__volatile = 0; + static gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { diff --git a/gtk/gtkexpression.c b/gtk/gtkexpression.c index 0974face66..b08c8bf80f 100644 --- a/gtk/gtkexpression.c +++ b/gtk/gtkexpression.c @@ -249,7 +249,7 @@ struct _GtkExpressionWatch GType \ type_name ## _get_type (void) \ { \ - static volatile gsize gtk_define_expression_type_id__volatile; \ + static gsize gtk_define_expression_type_id__volatile; \ if (g_once_init_enter (>k_define_expression_type_id__volatile)) \ { \ GType gtk_define_expression_type_id = \ @@ -490,7 +490,7 @@ param_expression_values_cmp (GParamSpec *pspec, GType gtk_param_expression_get_type (void) { - static volatile gsize param_expression_type__volatile; + static gsize param_expression_type__volatile; if (g_once_init_enter (¶m_expression_type__volatile)) { @@ -598,7 +598,7 @@ gtk_expression_init (GtkExpression *self) GType gtk_expression_get_type (void) { - static volatile gsize expression_type__volatile; + static gsize expression_type__volatile; if (g_once_init_enter (&expression_type__volatile)) { diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c index 00f1a6c381..13937ad9bd 100644 --- a/gtk/gtkprintoperation-win32.c +++ b/gtk/gtkprintoperation-win32.c @@ -1713,7 +1713,7 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op, GtkPrintOperationPrivate *priv; IPrintDialogCallback *callback; HPROPSHEETPAGE prop_page; - static volatile gsize common_controls_initialized = 0; + static gsize common_controls_initialized = 0; if (g_once_init_enter (&common_controls_initialized)) { diff --git a/gtk/gtkprivatetypebuiltins.c.template b/gtk/gtkprivatetypebuiltins.c.template index d7961be8ef..031ffb8020 100644 --- a/gtk/gtkprivatetypebuiltins.c.template +++ b/gtk/gtkprivatetypebuiltins.c.template @@ -14,7 +14,7 @@ GType _@enum_name@_get_type (void) { - static volatile gsize g_define_type_id__volatile = 0; + static gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { diff --git a/gtk/gtktypebuiltins.c.template b/gtk/gtktypebuiltins.c.template index 9a5a360f09..844e546b3d 100644 --- a/gtk/gtktypebuiltins.c.template +++ b/gtk/gtktypebuiltins.c.template @@ -13,7 +13,7 @@ GType @enum_name@_get_type (void) { - static volatile gsize g_define_type_id__volatile = 0; + static gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) {