diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-02 10:30:25 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-02 10:30:25 +0100 |
commit | 44a3eaeba04ef78835ca741592c376428ada5f71 (patch) | |
tree | 29cc935fd475678dcbe38972bfa77fdc68ffb10d /tests/test-stddef.c | |
parent | 6b73edd95d603e27d55d4905134ac1327d426534 (diff) |
New upstream version 0.9.8upstream/0.9.8
Diffstat (limited to 'tests/test-stddef.c')
-rw-r--r-- | tests/test-stddef.c | 10 |
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)); |