summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-07-20 12:41:57 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-07-23 09:18:43 +0100
commit9060a85193a0e15f67568ea6cac3a082fbcab30f (patch)
tree61fc240d8e92ce0990159d6062627a653ad995c9
parent7269d75321b9d2a967a59fb35f243397f577eb41 (diff)
glib-init: statically assert that we have 8-bit bytes
configure.ac assumes this. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=730932
-rw-r--r--configure.ac1
-rw-r--r--glib/glib-init.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f5f23b721..6e22fcba3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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;
diff --git a/glib/glib-init.c b/glib/glib-init.c
index df812c7d0..24efe9dc1 100644
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -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));