GType: Use guintptr as the underlying storage if larger than gsize

This is required for CHERI systems such as Arm Morello, where gsize is
not large enough to hold a pointer. As GType can contain pointers, we
have to use guintptr instead.
This commit is contained in:
Alex Richardson 2022-12-14 23:55:17 +00:00 committed by Philip Withnall
parent 70c66766f7
commit 4b111f1650

View File

@ -421,9 +421,11 @@ G_BEGIN_DECLS
* A numerical value which represents the unique identifier of a registered * A numerical value which represents the unique identifier of a registered
* type. * type.
*/ */
#if GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined (G_CXX_STD_VERSION) #if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_SIZE_T
typedef guintptr GType;
#elif GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined (G_CXX_STD_VERSION)
typedef gsize GType; typedef gsize GType;
#else /* for historic reasons, C++ links against gulong GTypes */ #else /* for historic reasons, C++ on non-Morello/CHERI systems links against gulong GTypes */
typedef gulong GType; typedef gulong GType;
#endif #endif
typedef struct _GValue GValue; typedef struct _GValue GValue;