[glib/wip/smcv/assert-standard-types: 2/2] glib-unix: Assert that our portable types correspond to ssize_t and pid_t
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/smcv/assert-standard-types: 2/2] glib-unix: Assert that our portable types correspond to ssize_t and pid_t
- Date: Fri, 2 Oct 2020 14:08:07 +0000 (UTC)
commit 8c0a96fa12490943891d9d8f8109e1bce1a7191a
Author: Simon McVittie <smcv collabora com>
Date: Fri Oct 2 15:07:32 2020 +0100
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 <smcv collabora com>
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 <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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]