summaryrefslogtreecommitdiff
path: root/tests/test-limits-h.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:32 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:32 +0100
commit00893e79fc62966067af1a106567db96bd170338 (patch)
tree52b35cd0b42ca28e62a2ffbecade2e13dd8332cf /tests/test-limits-h.c
parent26112352a774737e1ce5580c93654a26c1e82b39 (diff)
New upstream version 1.2upstream/1.2
Diffstat (limited to 'tests/test-limits-h.c')
-rw-r--r--tests/test-limits-h.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/test-limits-h.c b/tests/test-limits-h.c
index ddcb5d56..6f574c88 100644
--- a/tests/test-limits-h.c
+++ b/tests/test-limits-h.c
@@ -1,5 +1,5 @@
/* Test of <limits.h> substitute.
- Copyright 2016-2022 Free Software Foundation, Inc.
+ Copyright 2016-2024 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
@@ -94,7 +94,11 @@ unsigned long long limits11[] = { ULLONG_MAX };
static_assert (TYPE_MINIMUM (unsigned long long int) == 0);
static_assert (TYPE_MAXIMUM (unsigned long long int) == ULLONG_MAX);
-/* Macros specified by ISO/IEC TS 18661-1:2014. */
+/* Specified by POSIX, not by ISO C. */
+
+long long limits12[] = { SSIZE_MAX };
+
+/* Macros specified by C23 and by ISO/IEC TS 18661-1:2014. */
verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX);
verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX);
@@ -108,10 +112,19 @@ verify_width (ULONG_WIDTH, 0, ULONG_MAX);
verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX);
verify_width (ULLONG_WIDTH, 0, ULLONG_MAX);
-/* Macros specified by C2x. */
+/* Macros specified by C23. */
int bool_attrs[] = { BOOL_MAX, BOOL_WIDTH };
-static_assert (BOOL_MAX == (((1U << (BOOL_WIDTH - 1)) - 1) * 2) + 1);
+static_assert (BOOL_MAX == 1);
+
+static_assert (0 < MB_LEN_MAX);
+
+/* Get ssize_t, size_t. */
+#include <sys/types.h>
+
+static_assert (TYPE_MAXIMUM (ssize_t) == SSIZE_MAX);
+/* Verify that ssize_t has the same width as size_t. */
+static_assert (TYPE_MAXIMUM (size_t) / 2 == SSIZE_MAX);
int
main (void)