+2017-02-08 Paul Eggert <eggert@cs.ucla.edu>
+
+ stddef-tests: port to SIZE_MAX <= INT_MAX
+ * tests/test-stddef.c: Include <limits.h>, for INT_MAX.
+ Do not assume that INT_MAX < SIZE_MAX.
+
2017-02-01 Bruno Haible <bruno@clisp.org>
lock tests: Fix link error.
#include <config.h>
#include <stddef.h>
+#include <limits.h>
#include <stdalign.h>
#include "verify.h"
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));