From 00893e79fc62966067af1a106567db96bd170338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 3 Mar 2024 19:11:32 +0100 Subject: New upstream version 1.2 --- tests/test-limits-h.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'tests/test-limits-h.c') 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 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 + +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) -- cgit v1.2.3