From fca98249781ed18613c35c42d3e51c084d506050 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 2 Oct 2020 15:07:32 +0100 Subject: glib-unix: Assert that our portable types correspond to ssize_t and pid_t 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 --- glib/glib-unix.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 #include +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 -- cgit v1.2.1