summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2020-10-02 15:07:32 +0100
committerSimon McVittie <smcv@collabora.com>2020-10-02 15:45:44 +0100
commitfca98249781ed18613c35c42d3e51c084d506050 (patch)
treef629fab1d40ac97be6286c97b48e651926c4c196
parentbd1e2a984ec532d35dba0e5ffc852ffd6c894890 (diff)
downloadglib-wip/smcv/assert-standard-types.tar.gz
glib-unix: Assert that our portable types correspond to ssize_t and pid_twip/smcv/assert-standard-types
If this fails to compile on some particularly bizarre Unix platform, we can relax these assertions; but our expectation is that gssize is POSIX ssize_t, and that on Unix, GPid is POSIX pid_t. Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--glib/glib-unix.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/glib/glib-unix.c b/glib/glib-unix.c
index 608fbd6e6..9d2877c66 100644
--- a/glib/glib-unix.c
+++ b/glib/glib-unix.c
@@ -33,6 +33,12 @@
#include <sys/types.h>
#include <pwd.h>
+G_STATIC_ASSERT (sizeof (ssize_t) == GLIB_SIZEOF_SSIZE_T);
+G_STATIC_ASSERT (G_ALIGNOF (gssize) == G_ALIGNOF (ssize_t));
+
+G_STATIC_ASSERT (sizeof (GPid) == sizeof (pid_t));
+G_STATIC_ASSERT (G_ALIGNOF (GPid) == G_ALIGNOF (pid_t));
+
/**
* SECTION:gunix
* @title: UNIX-specific utilities and integration