Merge branch 'ghash-gvariant-cheri-layout' into 'main'

Make GVariant/GHash opaque types compatible with CHERI

See merge request GNOME/glib!3146
This commit is contained in:
Philip Withnall 2023-04-14 17:02:54 +00:00
commit d46405029c
3 changed files with 12 additions and 9 deletions

View File

@ -251,7 +251,8 @@
#define BIG_ENTRY_SIZE (SIZEOF_VOID_P)
#define SMALL_ENTRY_SIZE (SIZEOF_INT)
#if SMALL_ENTRY_SIZE < BIG_ENTRY_SIZE
/* NB: The USE_SMALL_ARRAYS code assumes pointers are at most 8 bytes. */
#if SMALL_ENTRY_SIZE < BIG_ENTRY_SIZE && BIG_ENTRY_SIZE <= 8
# define USE_SMALL_ARRAYS
#endif
@ -292,7 +293,7 @@ typedef struct
gpointer dummy2;
gint position;
gboolean dummy3;
gint version;
gintptr version;
} RealIter;
G_STATIC_ASSERT (sizeof (GHashTableIter) == sizeof (RealIter));

View File

@ -2951,6 +2951,8 @@ struct heap_iter
gsize magic;
};
G_STATIC_ASSERT (sizeof (struct heap_iter) <= sizeof (GVariantIter));
#define GVSI(i) ((struct stack_iter *) (i))
#define GVHI(i) ((struct heap_iter *) (i))
#define GVSI_MAGIC ((gsize) 3579507750u)
@ -3220,7 +3222,7 @@ struct heap_builder
/* Just to make sure that by adding a union to GVariantBuilder, we
* didn't accidentally change ABI. */
G_STATIC_ASSERT (sizeof (GVariantBuilder) == sizeof (gsize[16]));
G_STATIC_ASSERT (sizeof (GVariantBuilder) == sizeof (guintptr[16]));
static gboolean
ensure_valid_builder (GVariantBuilder *builder)
@ -3907,7 +3909,7 @@ struct heap_dict
/* Just to make sure that by adding a union to GVariantDict, we didn't
* accidentally change ABI. */
G_STATIC_ASSERT (sizeof (GVariantDict) == sizeof (gsize[16]));
G_STATIC_ASSERT (sizeof (GVariantDict) == sizeof (guintptr[16]));
static gboolean
ensure_valid_dict (GVariantDict *dict)

View File

@ -270,7 +270,7 @@ GVariant * g_variant_new_from_data (const G
typedef struct _GVariantIter GVariantIter;
struct _GVariantIter {
/*< private >*/
gsize x[16];
guintptr x[16];
};
GLIB_AVAILABLE_IN_ALL
@ -304,9 +304,9 @@ struct _GVariantBuilder {
struct {
gsize partial_magic;
const GVariantType *type;
gsize y[14];
guintptr y[14];
} s;
gsize x[16];
guintptr x[16];
} u;
};
@ -453,9 +453,9 @@ struct _GVariantDict {
struct {
GVariant *asv;
gsize partial_magic;
gsize y[14];
guintptr y[14];
} s;
gsize x[16];
guintptr x[16];
} u;
};