summaryrefslogtreecommitdiff
path: root/gobject
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2022-12-14 23:55:17 +0000
committerPhilip Withnall <philip@tecnocode.co.uk>2023-10-24 12:14:37 +0100
commit4b111f16507d66eeaf9f082036b51ac204b05732 (patch)
tree932f58be4bd334ce51a22b7864d40adadc2cc067 /gobject
parent70c66766f728e73313a20dfce425397aa4c4b2b0 (diff)
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.
Diffstat (limited to 'gobject')
-rw-r--r--gobject/gtype.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/gobject/gtype.h b/gobject/gtype.h
index f484199ac..2d067925c 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -421,9 +421,11 @@ G_BEGIN_DECLS
* A numerical value which represents the unique identifier of a registered
* 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;
-#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;
#endif
typedef struct _GValue GValue;