glib-init: statically assert that we have 8-bit bytes
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Sun, 20 Jul 2014 11:41:57 +0000 (12:41 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 23 Jul 2014 08:18:43 +0000 (09:18 +0100)
configure.ac assumes this.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=730932

configure.ac
glib/glib-init.c

index f5f23b7..6e22fcb 100644 (file)
@@ -2812,6 +2812,7 @@ _______EOF
 
 
        ### this should always be true in a modern C/C++ compiler
+       ### and is statically asserted by glib-init.c
        cat >>$outfile <<_______EOF
 typedef signed char gint8;
 typedef unsigned char guint8;
index df812c7..24efe9d 100644 (file)
@@ -35,6 +35,9 @@
 /* This seems as good a place as any to make static assertions about platform
  * assumptions we make throughout GLib. */
 
+/* We do not support 36-bit bytes or other historical curiosities. */
+G_STATIC_ASSERT (CHAR_BIT == 8);
+
 /* We assume that data pointers are the same size as function pointers... */
 G_STATIC_ASSERT (sizeof (gpointer) == sizeof (GFunc));
 G_STATIC_ASSERT (_g_alignof (gpointer) == _g_alignof (GFunc));