Merge branch 'genums-cheri' into 'main'

genums: use g_once_init_enter_pointer for GType initializers

See merge request GNOME/glib!3826
This commit is contained in:
Philip Withnall 2024-01-16 09:00:55 +00:00
commit 0eecb2b876

View File

@ -320,14 +320,14 @@ void g_flags_complete_type_info (GType g_flags_type,
#define G_DEFINE_ENUM_TYPE(TypeName, type_name, ...) \
GType \
type_name ## _get_type (void) { \
static gsize g_define_type__static = 0; \
if (g_once_init_enter (&g_define_type__static)) { \
static _g_type_once_init_type g_define_type__static = 0; \
if (_g_type_once_init_enter (&g_define_type__static)) { \
static const GEnumValue enum_values[] = { \
__VA_ARGS__ , \
{ 0, NULL, NULL }, \
}; \
GType g_define_type = g_enum_register_static (g_intern_static_string (#TypeName), enum_values); \
g_once_init_leave (&g_define_type__static, g_define_type); \
_g_type_once_init_leave (&g_define_type__static, g_define_type); \
} \
return g_define_type__static; \
} \
@ -363,14 +363,14 @@ type_name ## _get_type (void) { \
#define G_DEFINE_FLAGS_TYPE(TypeName, type_name, ...) \
GType \
type_name ## _get_type (void) { \
static gsize g_define_type__static = 0; \
if (g_once_init_enter (&g_define_type__static)) { \
static _g_type_once_init_type g_define_type__static = 0; \
if (_g_type_once_init_enter (&g_define_type__static)) { \
static const GFlagsValue flags_values[] = { \
__VA_ARGS__ , \
{ 0, NULL, NULL }, \
}; \
GType g_define_type = g_flags_register_static (g_intern_static_string (#TypeName), flags_values); \
g_once_init_leave (&g_define_type__static, g_define_type); \
_g_type_once_init_leave (&g_define_type__static, g_define_type); \
} \
return g_define_type__static; \
} \