diff options
author | Simon McVittie <smcv@collabora.com> | 2020-10-02 15:07:32 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2020-10-02 15:45:44 +0100 |
commit | fca98249781ed18613c35c42d3e51c084d506050 (patch) | |
tree | f629fab1d40ac97be6286c97b48e651926c4c196 | |
parent | bd1e2a984ec532d35dba0e5ffc852ffd6c894890 (diff) | |
download | glib-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.c | 6 |
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 |