summaryrefslogtreecommitdiff
path: root/tests/test-stddef.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-03 20:50:11 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-03 20:50:11 +0100
commit4cf52fc0bc3b80c0ef6c58c5db4413ebdafe661c (patch)
tree676b26b024117cf656080a011e3d17b8fb6889af /tests/test-stddef.c
parent1ecbfbb92248e67b564f5b144c4671ccaa86ee2f (diff)
parent44ff3127b1e57b703c2a73a24f7ab38e4aad8ae4 (diff)
Merge branch 'release/0.9.8-1'0.9.8-1
Diffstat (limited to 'tests/test-stddef.c')
-rw-r--r--tests/test-stddef.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/test-stddef.c b/tests/test-stddef.c
index bfb72a01..5bd2f788 100644
--- a/tests/test-stddef.c
+++ b/tests/test-stddef.c
@@ -1,5 +1,5 @@
/* Test of <stddef.h> substitute.
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ Copyright (C) 2009-2017 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,13 +12,14 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Eric Blake <ebb9@byu.net>, 2009. */
#include <config.h>
#include <stddef.h>
+#include <limits.h>
#include <stdalign.h>
#include "verify.h"
@@ -43,9 +44,12 @@ struct d
unlikely to bite real code, we ignore that short-coming. */
/* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */
verify (sizeof (offsetof (struct d, e)) == sizeof (size_t));
-verify (offsetof (struct d, e) < -1); /* Must be unsigned. */
verify (offsetof (struct d, f) == 1);
+/* offsetof promotes to an unsigned integer if and only if sizes do
+ not fit in int. */
+verify ((offsetof (struct d, e) < -1) == (INT_MAX < (size_t) -1));
+
/* Check max_align_t's alignment. */
verify (alignof (double) <= alignof (max_align_t));
verify (alignof (int) <= alignof (max_align_t));