core: drop "volatile" for g_once_init_enter locations

This fixes a few (fatal in gcc 11) warnings.

See https://gitlab.gnome.org/GNOME/glib/-/issues/600
This commit is contained in:
Aleksander Morgado
2021-05-18 11:28:18 +02:00
parent 0ea6e01c9b
commit 268cab885b
4 changed files with 33 additions and 33 deletions

View File

@@ -24,16 +24,16 @@ static const G@Type@Value @enum_name@_values[] = {
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_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) { if (g_once_init_enter (&g_define_type_id_initialized)) {
GType g_define_type_id = GType g_define_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"), g_@type@_register_static (g_intern_static_string ("@EnumName@"),
@enum_name@_values); @enum_name@_values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
} }
return g_define_type_id__volatile; return g_define_type_id_initialized;
} }
/** /**

View File

@@ -12,9 +12,9 @@
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_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) if (g_once_init_enter (&g_define_type_id_initialized))
{ {
static const G@Type@Value values[] = { static const G@Type@Value values[] = {
/*** END value-header ***/ /*** END value-header ***/
@@ -28,10 +28,10 @@ GType
}; };
GType g_define_type_id = GType g_define_type_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_define_type_id__volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
} }
return g_define_type_id__volatile; return g_define_type_id_initialized;
} }
/*** END value-tail ***/ /*** END value-tail ***/

View File

@@ -76,7 +76,7 @@ static const LogDesc level_descs[] = {
}; };
static GString *msgbuf = NULL; static GString *msgbuf = NULL;
static volatile gsize msgbuf_once = 0; static gsize msgbuf_once = 0;
static int static int
mm_to_syslog_priority (MMLogLevel level) mm_to_syslog_priority (MMLogLevel level)

View File

@@ -37,18 +37,18 @@ uint16_array_copy (guint16 *array)
GType GType
mm_uint16_array_get_type (void) mm_uint16_array_get_type (void)
{ {
static volatile gsize g_define_type_id__volatile = 0; static gsize g_define_type_id_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) { if (g_once_init_enter (&g_define_type_id_initialized)) {
GType g_define_type_id = GType g_define_type_id =
g_boxed_type_register_static (g_intern_static_string ("MMUint16Array"), g_boxed_type_register_static (g_intern_static_string ("MMUint16Array"),
(GBoxedCopyFunc) uint16_array_copy, (GBoxedCopyFunc) uint16_array_copy,
(GBoxedFreeFunc) g_free); (GBoxedFreeFunc) g_free);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
} }
return g_define_type_id__volatile; return g_define_type_id_initialized;
} }
static mm_uint16_pair * static mm_uint16_pair *
@@ -72,18 +72,18 @@ uint16_pair_array_copy (mm_uint16_pair *array)
GType GType
mm_uint16_pair_array_get_type (void) mm_uint16_pair_array_get_type (void)
{ {
static volatile gsize g_define_type_id__volatile = 0; static gsize g_define_type_id_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) { if (g_once_init_enter (&g_define_type_id_initialized)) {
GType g_define_type_id = GType g_define_type_id =
g_boxed_type_register_static (g_intern_static_string ("MMUint16PairArray"), g_boxed_type_register_static (g_intern_static_string ("MMUint16PairArray"),
(GBoxedCopyFunc) uint16_pair_array_copy, (GBoxedCopyFunc) uint16_pair_array_copy,
(GBoxedFreeFunc) g_free); (GBoxedFreeFunc) g_free);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
} }
return g_define_type_id__volatile; return g_define_type_id_initialized;
} }
static void static void
@@ -122,18 +122,18 @@ str_pair_array_copy (mm_str_pair *array)
GType GType
mm_str_pair_array_get_type (void) mm_str_pair_array_get_type (void)
{ {
static volatile gsize g_define_type_id__volatile = 0; static gsize g_define_type_id_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) { if (g_once_init_enter (&g_define_type_id_initialized)) {
GType g_define_type_id = GType g_define_type_id =
g_boxed_type_register_static (g_intern_static_string ("MMStrPairArray"), g_boxed_type_register_static (g_intern_static_string ("MMStrPairArray"),
(GBoxedCopyFunc) str_pair_array_copy, (GBoxedCopyFunc) str_pair_array_copy,
(GBoxedFreeFunc) str_pair_array_free); (GBoxedFreeFunc) str_pair_array_free);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
} }
return g_define_type_id__volatile; return g_define_type_id_initialized;
} }
static gpointer * static gpointer *
@@ -157,18 +157,18 @@ pointer_array_copy (gpointer *array)
GType GType
mm_pointer_array_get_type (void) mm_pointer_array_get_type (void)
{ {
static volatile gsize g_define_type_id__volatile = 0; static gsize g_define_type_id_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) { if (g_once_init_enter (&g_define_type_id_initialized)) {
GType g_define_type_id = GType g_define_type_id =
g_boxed_type_register_static (g_intern_static_string ("MMPointerArray"), g_boxed_type_register_static (g_intern_static_string ("MMPointerArray"),
(GBoxedCopyFunc) pointer_array_copy, (GBoxedCopyFunc) pointer_array_copy,
(GBoxedFreeFunc) g_free); (GBoxedFreeFunc) g_free);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
} }
return g_define_type_id__volatile; return g_define_type_id_initialized;
} }
static GPtrArray * static GPtrArray *
@@ -186,18 +186,18 @@ object_array_free (GPtrArray *object_array)
GType GType
mm_object_array_get_type (void) mm_object_array_get_type (void)
{ {
static volatile gsize g_define_type_id__volatile = 0; static gsize g_define_type_id_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) { if (g_once_init_enter (&g_define_type_id_initialized)) {
GType g_define_type_id = GType g_define_type_id =
g_boxed_type_register_static (g_intern_static_string ("MMObjectArray"), g_boxed_type_register_static (g_intern_static_string ("MMObjectArray"),
(GBoxedCopyFunc) object_array_copy, (GBoxedCopyFunc) object_array_copy,
(GBoxedFreeFunc) object_array_free); (GBoxedFreeFunc) object_array_free);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
} }
return g_define_type_id__volatile; return g_define_type_id_initialized;
} }
static void static void
@@ -223,16 +223,16 @@ async_method_copy (MMAsyncMethod *original)
GType GType
mm_async_method_get_type (void) mm_async_method_get_type (void)
{ {
static volatile gsize g_define_type_id__volatile = 0; static gsize g_define_type_id_initialized = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) { if (g_once_init_enter (&g_define_type_id_initialized)) {
GType g_define_type_id = GType g_define_type_id =
g_boxed_type_register_static (g_intern_static_string ("MMAsyncMethod"), g_boxed_type_register_static (g_intern_static_string ("MMAsyncMethod"),
(GBoxedCopyFunc) async_method_copy, (GBoxedCopyFunc) async_method_copy,
(GBoxedFreeFunc) async_method_free); (GBoxedFreeFunc) async_method_free);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
} }
return g_define_type_id__volatile; return g_define_type_id_initialized;
} }