]> Savannah Git Hosting - gnulib.git/commitdiff
limits-h tests: Check the value of SSIZE_MAX.
authorBruno Haible <bruno@clisp.org>
Sun, 21 May 2023 12:42:27 +0000 (14:42 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 21 May 2023 12:42:27 +0000 (14:42 +0200)
* tests/test-limits-h.c (limits12): New variable.
Include <sys/types.h> and check the value of SSIZE_MAX.
* modules/limits-h-tests (Depends-on): Add sys_types.

ChangeLog
modules/limits-h-tests
tests/test-limits-h.c

index e205c02f43b222bd465d097eb706370de5fda970..9cdb603b9b102c11a3c6c295750d6bf5c57f8e5f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-05-21  Bruno Haible  <bruno@clisp.org>
+
+       limits-h tests: Check the value of SSIZE_MAX.
+       * tests/test-limits-h.c (limits12): New variable.
+       Include <sys/types.h> and check the value of SSIZE_MAX.
+       * modules/limits-h-tests (Depends-on): Add sys_types.
+
 2023-05-21  Bruno Haible  <bruno@clisp.org>
 
        ssize_t: Fix replacement on 64-bit Windows.
index 2cf0a41f5dc4c34a812bb9b0bb9438e0361d0c95..51919ad1a17d6e70fe027849577041458a3ac070 100644 (file)
@@ -4,6 +4,7 @@ tests/test-limits-h.c
 Depends-on:
 assert-h
 extensions
+sys_types
 limits-h-c++-tests
 
 configure.ac:
index d7cfba713108c50cbdc9f571860cdc812fa3d825..253d2362e7a32f054c6b3e850cd9580e20642cbf 100644 (file)
@@ -94,6 +94,10 @@ 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);
 
+/* 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);
@@ -115,6 +119,13 @@ static_assert (BOOL_MAX == (((1U << (BOOL_WIDTH - 1)) - 1) * 2) + 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)
 {