genums: use g_once_init_enter_pointer for GType initializers

GType is either an integer or a pointer, so we have to use the _pointer
version here to support architectures such as Morello.

These two lines were missed in 5ecd3cbe52
and allows the gobject/enums test to pass on CheriBSD (Morello).

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
This commit is contained in:
Alex Richardson 2024-01-10 15:02:38 -08:00
parent 35fe0d0bba
commit dfa0d60db2

View File

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