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.
This commit is contained in:
Christian Hergert 2020-11-18 19:58:09 -08:00
parent 7551f85d4c
commit 0d2ea14ac1
11 changed files with 15 additions and 15 deletions

View File

@ -12,7 +12,7 @@
GType GType
@enum_name@_get_type (void) @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)) if (g_once_init_enter (&g_define_type_id__volatile))
{ {

View File

@ -210,7 +210,7 @@ gdk_event_init (GdkEvent *self)
GType GType
gdk_event_get_type (void) gdk_event_get_type (void)
{ {
static volatile gsize event_type__volatile; static gsize event_type__volatile;
if (g_once_init_enter (&event_type__volatile)) if (g_once_init_enter (&event_type__volatile))
{ {
@ -374,7 +374,7 @@ static GType gdk_event_types[GDK_EVENT_LAST];
GType \ GType \
type_name ## _get_type (void) \ 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)) \ if (g_once_init_enter (&gdk_define_event_type_id__volatile)) \
{ \ { \
GType gdk_define_event_type_id = \ GType gdk_define_event_type_id = \
@ -453,7 +453,7 @@ gdk_event_init_types_once (void)
void void
gdk_event_init_types (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)) if (g_once_init_enter (&event_types__volatile))
{ {

View File

@ -22,7 +22,7 @@ static guint gsk_debug_flags;
static void static void
init_debug_flags (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)) if (g_once_init_enter (&gsk_debug_flags__set))
{ {

View File

@ -13,7 +13,7 @@
GType GType
@enum_name@_get_type (void) @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)) if (g_once_init_enter (&g_define_type_id__volatile))
{ {

View File

@ -184,7 +184,7 @@ gsk_render_node_init (GskRenderNode *self)
GType GType
gsk_render_node_get_type (void) 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)) if (g_once_init_enter (&render_node_type__volatile))
{ {

View File

@ -5165,7 +5165,7 @@ gsk_render_node_init_types_once (void)
void void
gsk_render_node_init_types (void) gsk_render_node_init_types (void)
{ {
static volatile gsize register_types__volatile; static gsize register_types__volatile;
if (g_once_init_enter (&register_types__volatile)) if (g_once_init_enter (&register_types__volatile))
{ {

View File

@ -13,7 +13,7 @@
GType GType
@enum_name@_get_type (void) @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)) if (g_once_init_enter (&g_define_type_id__volatile))
{ {

View File

@ -249,7 +249,7 @@ struct _GtkExpressionWatch
GType \ GType \
type_name ## _get_type (void) \ 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 (&gtk_define_expression_type_id__volatile)) \ if (g_once_init_enter (&gtk_define_expression_type_id__volatile)) \
{ \ { \
GType gtk_define_expression_type_id = \ GType gtk_define_expression_type_id = \
@ -490,7 +490,7 @@ param_expression_values_cmp (GParamSpec *pspec,
GType GType
gtk_param_expression_get_type (void) gtk_param_expression_get_type (void)
{ {
static volatile gsize param_expression_type__volatile; static gsize param_expression_type__volatile;
if (g_once_init_enter (&param_expression_type__volatile)) if (g_once_init_enter (&param_expression_type__volatile))
{ {
@ -598,7 +598,7 @@ gtk_expression_init (GtkExpression *self)
GType GType
gtk_expression_get_type (void) gtk_expression_get_type (void)
{ {
static volatile gsize expression_type__volatile; static gsize expression_type__volatile;
if (g_once_init_enter (&expression_type__volatile)) if (g_once_init_enter (&expression_type__volatile))
{ {

View File

@ -1713,7 +1713,7 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op,
GtkPrintOperationPrivate *priv; GtkPrintOperationPrivate *priv;
IPrintDialogCallback *callback; IPrintDialogCallback *callback;
HPROPSHEETPAGE prop_page; HPROPSHEETPAGE prop_page;
static volatile gsize common_controls_initialized = 0; static gsize common_controls_initialized = 0;
if (g_once_init_enter (&common_controls_initialized)) if (g_once_init_enter (&common_controls_initialized))
{ {

View File

@ -14,7 +14,7 @@
GType GType
_@enum_name@_get_type (void) _@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)) if (g_once_init_enter (&g_define_type_id__volatile))
{ {

View File

@ -13,7 +13,7 @@
GType GType
@enum_name@_get_type (void) @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)) if (g_once_init_enter (&g_define_type_id__volatile))
{ {