]> Savannah Git Hosting - gnulib.git/commitdiff
memset_explicit tests: Verify N3322 functionality.
authorBruno Haible <bruno@clisp.org>
Tue, 5 Nov 2024 20:11:20 +0000 (21:11 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 5 Nov 2024 21:38:33 +0000 (22:38 +0100)
* tests/test-memset_explicit.c (main): Add a zero-size test.

ChangeLog
tests/test-memset_explicit.c

index d36d51ebb8d2b975fc83ed405ba3629a3671df7e..1c6facac48f7dc779b11cd273723dc8ca8b16c87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-11-05  Bruno Haible  <bruno@clisp.org>
+
+       memset_explicit tests: Verify N3322 functionality.
+       * tests/test-memset_explicit.c (main): Add a zero-size test.
+
 2024-11-05  Bruno Haible  <bruno@clisp.org>
 
        memset tests: Verify N3322 functionality.
index 477415b45f68096ce3050995e8f7d2e338d38c4f..79f2aad57070d633adae8bb7f2acb1cc9817c781 100644 (file)
@@ -243,5 +243,12 @@ main ()
   test_heap ();
   test_stack ();
 
+  /* Test zero-length operations on NULL pointers, allowed by
+     <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
+  {
+    int volatile value = (memset_explicit (NULL, '?', 0) == NULL);
+    ASSERT (value);
+  }
+
   return test_exit_status;
 }