mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
glib-init: Add more static assertions about gsize
Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/1484 Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
de2602736d
commit
43d8545045
@ -116,10 +116,16 @@ G_STATIC_ASSERT (sizeof (size_t) == GLIB_SIZEOF_SIZE_T);
|
||||
G_STATIC_ASSERT (sizeof (size_t) == GLIB_SIZEOF_SSIZE_T);
|
||||
G_STATIC_ASSERT (sizeof (gsize) == GLIB_SIZEOF_SSIZE_T);
|
||||
G_STATIC_ASSERT (sizeof (gsize) == sizeof (size_t));
|
||||
G_STATIC_ASSERT (G_MAXSIZE == SIZE_MAX);
|
||||
/* Again this is size_t not ssize_t, because ssize_t is POSIX, not C99 */
|
||||
G_STATIC_ASSERT (sizeof (gssize) == sizeof (size_t));
|
||||
G_STATIC_ASSERT (G_ALIGNOF (gsize) == G_ALIGNOF (size_t));
|
||||
G_STATIC_ASSERT (G_ALIGNOF (gssize) == G_ALIGNOF (size_t));
|
||||
/* We assume that GSIZE_TO_POINTER is reversible by GPOINTER_TO_SIZE
|
||||
* without losing information.
|
||||
* However, we do not assume that GPOINTER_TO_SIZE can store an arbitrary
|
||||
* pointer in a gsize (known to be false on CHERI). */
|
||||
G_STATIC_ASSERT (sizeof (size_t) <= sizeof (void *));
|
||||
|
||||
/* goffset is always 64-bit, even if off_t is only 32-bit
|
||||
* (compiling without large-file-support on 32-bit) */
|
||||
|
Loading…
Reference in New Issue
Block a user