GBitLock: turn assumptions of g_futex_int_address into a static assertion

We'll probably never encounter a platform where these fail, but that's
what static assertions are for...

https://bugzilla.gnome.org/show_bug.cgi?id=548954
This commit is contained in:
Simon McVittie 2011-12-06 11:35:02 +00:00 committed by Ryan Lortie
parent fc731de929
commit 1425aa664d

View File

@ -366,6 +366,12 @@ g_futex_int_address (const volatile void *address)
{
const volatile gint *int_address = address;
/* this implementation makes these (reasonable) assumptions: */
G_STATIC_ASSERT (G_BYTE_ORDER == G_LITTLE_ENDIAN ||
(G_BYTE_ORDER == G_BIG_ENDIAN &&
sizeof (int) == 4 &&
(sizeof (gpointer) == 4 || sizeof (gpointer) == 8)));
#if G_BYTE_ORDER == G_BIG_ENDIAN && GLIB_SIZEOF_VOID_P == 8
int_address++;
#endif