]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
tests: Make last patch side-effect free.
authorBruno Haible <bruno@clisp.org>
Tue, 11 Aug 2026 20:35:08 +0000 (22:35 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 11 Aug 2026 20:35:08 +0000 (22:35 +0200)
* tests/test-bsearch.c: Use another volatile function pointer variable.
* tests/test-memccpy.c: Likewise.
* tests/test-memchr.c: Likewise.
* tests/test-memcmp.c: Likewise.
* tests/test-memcpy.c: Likewise.
* tests/test-memmove.c: Likewise.
* tests/test-memset.c: Likewise.
* tests/test-memset_explicit.c: Likewise.
* tests/test-qsort.c: Likewise.
* tests/test-strncat.c: Likewise.
* tests/test-strncmp.c: Likewise.
* tests/test-strncpy.c: Likewise.
* tests/test-strndup.c: Likewise.
* tests/test-wcsncat.c: Likewise.
* tests/test-wcsncmp.c: Likewise.
* tests/test-wcsncpy.c: Likewise.
* tests/test-wmemchr.c: Likewise.
* tests/test-wmemcmp.c: Likewise.
* tests/test-wmemcpy.c: Likewise.
* tests/test-wmemmove.c: Likewise.
* tests/test-wmemset.c: Likewise.

22 files changed:
ChangeLog
tests/test-bsearch.c
tests/test-memccpy.c
tests/test-memchr.c
tests/test-memcmp.c
tests/test-memcpy.c
tests/test-memmove.c
tests/test-memset.c
tests/test-memset_explicit.c
tests/test-qsort.c
tests/test-strncat.c
tests/test-strncmp.c
tests/test-strncpy.c
tests/test-strndup.c
tests/test-wcsncat.c
tests/test-wcsncmp.c
tests/test-wcsncpy.c
tests/test-wmemchr.c
tests/test-wmemcmp.c
tests/test-wmemcpy.c
tests/test-wmemmove.c
tests/test-wmemset.c

index fdc29cd9eb2599fe74d89b14cde1aa68c1d5d7c8..11fe00ddfb555f639564d7ea25d362afb5278dd7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2026-08-11  Bruno Haible  <bruno@clisp.org>
+
+       tests: Make last patch side-effect free.
+       * tests/test-bsearch.c: Use another volatile function pointer variable.
+       * tests/test-memccpy.c: Likewise.
+       * tests/test-memchr.c: Likewise.
+       * tests/test-memcmp.c: Likewise.
+       * tests/test-memcpy.c: Likewise.
+       * tests/test-memmove.c: Likewise.
+       * tests/test-memset.c: Likewise.
+       * tests/test-memset_explicit.c: Likewise.
+       * tests/test-qsort.c: Likewise.
+       * tests/test-strncat.c: Likewise.
+       * tests/test-strncmp.c: Likewise.
+       * tests/test-strncpy.c: Likewise.
+       * tests/test-strndup.c: Likewise.
+       * tests/test-wcsncat.c: Likewise.
+       * tests/test-wcsncmp.c: Likewise.
+       * tests/test-wcsncpy.c: Likewise.
+       * tests/test-wmemchr.c: Likewise.
+       * tests/test-wmemcmp.c: Likewise.
+       * tests/test-wmemcpy.c: Likewise.
+       * tests/test-wmemmove.c: Likewise.
+       * tests/test-wmemset.c: Likewise.
+
 2026-08-11  Lasse Collin  <lasse.collin@tukaani.org>
 
        tests: Verify N3322 compatibility of the function prototypes.
index 96df08b1ed517edbeb0c0c91673cd3996f85b577..9cfdcfe3cbc9c07e7d018d5a8bb5f1b0ec2998c0 100644 (file)
@@ -34,6 +34,10 @@ null_bsearch (void const *key, void const *base, size_t nel, size_t width,
 #endif
   return (void *) p;
 }
+static void *(*volatile volatile_null_bsearch) (void const *, void const *,
+                                                size_t, size_t,
+                                                int (*) (void const *, void const *))
+  = null_bsearch;
 
 /* Test the library, not the compiler+library.  */
 static void *
@@ -42,12 +46,12 @@ lib_bsearch (void const *key, void const *base, size_t nel, size_t width,
 {
   return (void *) bsearch (key, base, nel, width, compar);
 }
-static void *(*volatile volatile_bsearch) (void const *, void const *, size_t,
-                                           size_t,
-                                           int (*) (void const *, void const *))
+static void *(*volatile volatile_lib_bsearch) (void const *, void const *,
+                                               size_t, size_t,
+                                               int (*) (void const *, void const *))
   = lib_bsearch;
 #undef bsearch
-#define bsearch volatile_bsearch
+#define bsearch volatile_lib_bsearch
 
 static int
 cmp (const void *a, const void *b)
@@ -62,8 +66,7 @@ main (void)
      <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
   ASSERT (bsearch ("x", NULL, 0, 1, cmp) == NULL);
 
-  volatile_bsearch = null_bsearch;
-  ASSERT (bsearch ("x", NULL, 0, 1, cmp) == NULL);
+  ASSERT (volatile_null_bsearch ("x", NULL, 0, 1, cmp) == NULL);
 
   return test_exit_status;
 }
index 62a26b73bfaf20c0105923ba0af46162adae64c3..6f9e6d9c3438a5845e1fdaefed2aa851a682440c 100644 (file)
@@ -34,6 +34,9 @@ null_memccpy (void *dest, const void *src, int c, size_t n)
 #endif
   return p;
 }
+static void *(*volatile volatile_null_memccpy) (void *, void const *, int,
+                                                size_t)
+  = null_memccpy;
 
 /* Test the library, not the compiler+library.  */
 static void *
@@ -41,10 +44,11 @@ lib_memccpy (void *dest, void const *src, int c, size_t n)
 {
   return memccpy (dest, src, c, n);
 }
-static void *(*volatile volatile_memccpy) (void *, void const *, int, size_t)
+static void *(*volatile volatile_lib_memccpy) (void *, void const *, int,
+                                               size_t)
   = lib_memccpy;
 #undef memccpy
-#define memccpy volatile_memccpy
+#define memccpy volatile_lib_memccpy
 
 int
 main (void)
@@ -59,8 +63,7 @@ main (void)
     ASSERT (memccpy (y, NULL, '?', 0) == NULL);
   }
 
-  volatile_memccpy = null_memccpy;
-  ASSERT (memccpy (NULL, "x", '?', 0) == NULL);
+  ASSERT (volatile_null_memccpy (NULL, "x", '?', 0) == NULL);
 
   return test_exit_status;
 }
index 1edde65eeee035d3313e71c2f42cb7049145ce58..c125244a99de7eca11b41bb3c0a51e261d3accc8 100644 (file)
@@ -40,6 +40,8 @@ null_memchr (void const *s, int c, size_t n)
 #endif
   return (void *) p;
 }
+static void *(*volatile volatile_null_memchr) (void const *, int, size_t)
+  = null_memchr;
 
 /* Test the library, not the compiler+library.  */
 static void *
@@ -47,10 +49,10 @@ lib_memchr (void const *s, int c, size_t n)
 {
   return (void *) memchr (s, c, n);
 }
-static void *(*volatile volatile_memchr) (void const *, int, size_t)
+static void *(*volatile volatile_lib_memchr) (void const *, int, size_t)
   = lib_memchr;
 #undef memchr
-#define memchr volatile_memchr
+#define memchr volatile_lib_memchr
 
 int
 main (void)
@@ -152,8 +154,7 @@ main (void)
      <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
   ASSERT (memchr (NULL, '?', 0) == NULL);
 
-  volatile_memchr = null_memchr;
-  ASSERT (memchr (NULL, '?', 0) == NULL);
+  ASSERT (volatile_null_memchr (NULL, '?', 0) == NULL);
 
   return test_exit_status;
 }
index 30b99d273503e28e5a2c39abe5911045d43be125..be684031590a8f1370544218fe480dfd07673a52 100644 (file)
@@ -38,6 +38,8 @@ null_memcmp (void const *s1, void const *s2, size_t n)
 #endif
   return r;
 }
+int (*volatile volatile_null_memcmp) (void const *, void const *, size_t)
+  = null_memcmp;
 
 /* Test the library, not the compiler+library.  */
 static int
@@ -45,10 +47,10 @@ lib_memcmp (void const *s1, void const *s2, size_t n)
 {
   return memcmp (s1, s2, n);
 }
-int (*volatile volatile_memcmp) (void const *, void const *, size_t)
+int (*volatile volatile_lib_memcmp) (void const *, void const *, size_t)
   = lib_memcmp;
 #undef memcmp
-#define memcmp volatile_memcmp
+#define memcmp volatile_lib_memcmp
 
 int
 main (void)
@@ -100,8 +102,7 @@ main (void)
   ASSERT (memcmp ("x", NULL, 0) == 0);
   ASSERT (memcmp (NULL, NULL, 0) == 0);
 
-  volatile_memcmp = null_memcmp;
-  ASSERT (memcmp (NULL, "x", 0) == 0);
+  ASSERT (volatile_null_memcmp (NULL, "x", 0) == 0);
 
   return test_exit_status;
 }
index cd82b80d9ce1472576b41262a96d17f4b33a1792..8d0fdfb88d48c6cd5fc82551e33988badb01f61b 100644 (file)
@@ -36,6 +36,8 @@ null_memcpy (void *dest, const void *src, size_t n)
 #endif
   return p;
 }
+void *(*volatile volatile_null_memcpy) (void *, void const *, size_t)
+  = null_memcpy;
 
 /* Test the library, not the compiler+library.  */
 static void *
@@ -43,10 +45,10 @@ lib_memcpy (void *s1, void const *s2, size_t n)
 {
   return memcpy (s1, s2, n);
 }
-void *(*volatile volatile_memcpy) (void *, void const *, size_t)
+void *(*volatile volatile_lib_memcpy) (void *, void const *, size_t)
   = lib_memcpy;
 #undef memcpy
-#define memcpy volatile_memcpy
+#define memcpy volatile_lib_memcpy
 
 int
 main (void)
@@ -63,8 +65,7 @@ main (void)
 
   /* Redirect via the volatile function pointer to ensure that that the ASSERT
      in null_memcpy won't be optimized away by GCC 6.3.0.  */
-  volatile_memcpy = null_memcpy;
-  ASSERT (memcpy (NULL, "x", 0) == NULL);
+  ASSERT (volatile_null_memcpy (NULL, "x", 0) == NULL);
 
   return test_exit_status;
 }
index ef71b7c6fa43f2179d99225eabfc423bc31b39a4..8709e9082fbca59ae4c014f49ef284bf417b92a2 100644 (file)
@@ -36,6 +36,8 @@ null_memmove (void *dest, const void *src, size_t n)
 #endif
   return p;
 }
+static void *(*volatile volatile_null_memmove) (void *, void const *, size_t)
+  = null_memmove;
 
 /* Test the library, not the compiler+library.  */
 static void *
@@ -43,10 +45,10 @@ lib_memmove (void *s1, void const *s2, size_t n)
 {
   return memmove (s1, s2, n);
 }
-static void *(*volatile volatile_memmove) (void *, void const *, size_t)
+static void *(*volatile volatile_lib_memmove) (void *, void const *, size_t)
   = lib_memmove;
 #undef memmove
-#define memmove volatile_memmove
+#define memmove volatile_lib_memmove
 
 int
 main (void)
@@ -61,8 +63,7 @@ main (void)
     ASSERT (memmove (y, NULL, 0) == y);
   }
 
-  volatile_memmove = null_memmove;
-  ASSERT (memmove (NULL, "x", 0) == NULL);
+  ASSERT (volatile_null_memmove (NULL, "x", 0) == NULL);
 
   return test_exit_status;
 }
index 9e33fd947c1ed267fafcfe3f3ddb375887d73ee9..258d62754c96fd823eb1baaef833f5a1b175b9d7 100644 (file)
@@ -36,6 +36,8 @@ null_memset (void *s, int c, size_t n)
 #endif
   return p;
 }
+static void *(*volatile volatile_null_memset) (void *, int, size_t)
+  = null_memset;
 
 /* Test the library, not the compiler+library.  */
 static void *
@@ -43,10 +45,10 @@ lib_memset (void *s, int c, size_t n)
 {
   return memset (s, c, n);
 }
-static void *(*volatile volatile_memset) (void *, int, size_t)
+static void *(*volatile volatile_lib_memset) (void *, int, size_t)
   = lib_memset;
 #undef memset
-#define memset volatile_memset
+#define memset volatile_lib_memset
 
 int
 main (void)
@@ -55,8 +57,7 @@ main (void)
      <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
   ASSERT (memset (NULL, '?', 0) == NULL);
 
-  volatile_memset = null_memset;
-  ASSERT (memset (NULL, '?', 0) == NULL);
+  ASSERT (volatile_null_memset (NULL, '?', 0) == NULL);
 
   return test_exit_status;
 }
index b9bafa1399b31e787de5fd1fe88532daa88ff0a2..79f42a38c8e15ff164ff740f84417b5aa3ef92e3 100644 (file)
@@ -59,6 +59,8 @@ null_memset_explicit (void *s, int c, size_t n)
 #endif
   return p;
 }
+static void *(*volatile volatile_null_memset_explicit) (void *, int, size_t)
+  = null_memset_explicit;
 
 /* Test the library, not the compiler+library.  */
 static void *
@@ -66,10 +68,10 @@ lib_memset_explicit (void *s, int c, size_t n)
 {
   return memset_explicit (s, c, n);
 }
-static void *(*volatile volatile_memset_explicit) (void *, int, size_t)
+static void *(*volatile volatile_lib_memset_explicit) (void *, int, size_t)
   = lib_memset_explicit;
 #undef memset_explicit
-#define memset_explicit volatile_memset_explicit
+#define memset_explicit volatile_lib_memset_explicit
 
 /* Suppress GCC 13.2.1 false alarm, as this test needs a dangling pointer.  */
 #if _GL_GNUC_PREREQ (12, 0)
@@ -280,8 +282,7 @@ main ()
      <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
   ASSERT (memset_explicit (NULL, '?', 0) == NULL);
 
-  volatile_memset_explicit = null_memset_explicit;
-  ASSERT (memset_explicit (NULL, '?', 0) == NULL);
+  ASSERT (volatile_null_memset_explicit (NULL, '?', 0) == NULL);
 
   return test_exit_status;
 }
index 534a18987670751795348eb94e4e2c4c75d83834..9efbe5339752d84b0469aa9f88644f313376ff24 100644 (file)
@@ -32,6 +32,9 @@ null_qsort (void *base, size_t nel, size_t width,
   ASSERT (base == NULL);
 #endif
 }
+static void (*volatile volatile_null_qsort) (void *, size_t, size_t,
+                                             int (*) (void const *, void const *))
+  = null_qsort;
 
 /* Test the library, not the compiler+library.  */
 static void
@@ -40,11 +43,11 @@ lib_qsort (void *base, size_t nel, size_t width,
 {
   qsort (base, nel, width, compar);
 }
-static void (*volatile volatile_qsort) (void *, size_t, size_t,
-                                        int (*) (void const *, void const *))
+static void (*volatile volatile_lib_qsort) (void *, size_t, size_t,
+                                            int (*) (void const *, void const *))
   = lib_qsort;
 #undef qsort
-#define qsort volatile_qsort
+#define qsort volatile_lib_qsort
 
 static int
 cmp (const void *a, const void *b)
@@ -60,8 +63,7 @@ main (void)
 
   qsort (NULL, 0, 1, cmp);
 
-  volatile_qsort = null_qsort;
-  qsort (NULL, 0, 1, cmp);
+  volatile_null_qsort (NULL, 0, 1, cmp);
 
   return 0;
 }
index 7f542a3b37b07d3ae12fad093858c27a8c7ef159..2eeb46d77c2f2ad907de8af21837086f8b8bf63b 100644 (file)
@@ -42,6 +42,8 @@ null_strncat (char *s1, char const *s2, size_t n)
 #endif
   return p;
 }
+static char *(*volatile volatile_null_strncat) (char *, char const *, size_t)
+  = null_strncat;
 
 /* Test the library, not the compiler+library.  */
 static char *
@@ -49,10 +51,10 @@ lib_strncat (char *s1, char const *s2, size_t n)
 {
   return strncat (s1, s2, n);
 }
-static char *(*volatile volatile_strncat) (char *, char const *, size_t)
+static char *(*volatile volatile_lib_strncat) (char *, char const *, size_t)
   = lib_strncat;
 #undef strncat
-#define strncat volatile_strncat
+#define strncat volatile_lib_strncat
 
 #define UNIT char
 #define U_STRNCAT strncat
@@ -95,8 +97,7 @@ main ()
     char y[2] = { 'x', '\0' };
     ASSERT (strncat (y, NULL, 0) == y);
 
-    volatile_strncat = null_strncat;
-    ASSERT (strncat (y, NULL, 0) == y);
+    ASSERT (volatile_null_strncat (y, NULL, 0) == y);
   }
 
   return test_exit_status;
index 0108e6eb55715710b7546a5ee4a01ffdf363a560..95ff26085a64a501ff8aa464146d1746c4e406a3 100644 (file)
@@ -36,6 +36,9 @@ null_strncmp (char const *s1, char const *s2, size_t n)
 #endif
   return r;
 }
+static int (*volatile volatile_null_strncmp) (char const *, char const *,
+                                              size_t)
+  = null_strncmp;
 
 /* Test the library, not the compiler+library.  */
 static int
@@ -43,10 +46,11 @@ lib_strncmp (char const *s1, char const *s2, size_t n)
 {
   return strncmp (s1, s2, n);
 }
-static int (*volatile volatile_strncmp) (char const *, char const *, size_t)
+static int (*volatile volatile_lib_strncmp) (char const *, char const *,
+                                             size_t)
   = lib_strncmp;
 #undef strncmp
-#define strncmp volatile_strncmp
+#define strncmp volatile_lib_strncmp
 
 int
 main (void)
@@ -57,8 +61,7 @@ main (void)
   ASSERT (strncmp ("x", NULL, 0) == 0);
   ASSERT (strncmp (NULL, NULL, 0) == 0);
 
-  volatile_strncmp = null_strncmp;
-  ASSERT (strncmp (NULL, "x", 0) == 0);
+  ASSERT (volatile_null_strncmp (NULL, "x", 0) == 0);
 
   return test_exit_status;
 }
index 0c116bd9aaaecb66498d876716f5241ca4a708bf..80b79f4e0c42bec5920e94f20cfb1a752d4effe9 100644 (file)
@@ -38,6 +38,8 @@ null_strncpy (char *s1, char const *s2, size_t n)
 #endif
   return p;
 }
+static char *(*volatile volatile_null_strncpy) (char *, char const *, size_t)
+  = null_strncpy;
 
 /* Test the library, not the compiler+library.  */
 static char *
@@ -45,10 +47,10 @@ lib_strncpy (char *s1, char const *s2, size_t n)
 {
   return strncpy (s1, s2, n);
 }
-static char *(*volatile volatile_strncpy) (char *, char const *, size_t)
+static char *(*volatile volatile_lib_strncpy) (char *, char const *, size_t)
   = lib_strncpy;
 #undef strncpy
-#define strncpy volatile_strncpy
+#define strncpy volatile_lib_strncpy
 
 #define MAGIC (char)0xBA
 
@@ -131,8 +133,7 @@ main (void)
     char y[1];
     ASSERT (strncpy (y, NULL, 0) == y);
 
-    volatile_strncpy = null_strncpy;
-    ASSERT (strncpy (y, NULL, 0) == y);
+    ASSERT (volatile_null_strncpy (y, NULL, 0) == y);
   }
 
   return test_exit_status;
index 86ad433cfd4c2da15ef381c85e03a4d547e8f281..84c94184b64598b3159890f436c4d975038ba407 100644 (file)
@@ -36,6 +36,8 @@ null_strndup (char const *s, size_t size)
 #endif
   return p;
 }
+static char *(*volatile volatile_null_strndup) (char const *, size_t)
+  = null_strndup;
 
 /* Test the library, not the compiler+library.  */
 static char *
@@ -43,10 +45,10 @@ lib_strndup (char const *s, size_t size)
 {
   return strndup (s, size);
 }
-static char *(*volatile volatile_strndup) (char const *, size_t)
+static char *(*volatile volatile_lib_strndup) (char const *, size_t)
   = lib_strndup;
 #undef strndup
-#define strndup volatile_strndup
+#define strndup volatile_lib_strndup
 
 int
 main (void)
@@ -55,8 +57,7 @@ main (void)
      <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
   ASSERT (strndup (NULL, 0) != NULL);
 
-  volatile_strndup = null_strndup;
-  ASSERT (strndup (NULL, 0) != NULL);
+  ASSERT (volatile_null_strndup (NULL, 0) != NULL);
 
   return test_exit_status;
 }
index 26f0168e4771071f7cf37f8c2bb89f98badf9140..f18f77a30040e07b04b6aa3873a9846d6de076df 100644 (file)
@@ -36,6 +36,9 @@ null_wcsncat (wchar_t *ws1, wchar_t const *ws2, size_t n)
 #endif
   return p;
 }
+static wchar_t *(*volatile volatile_null_wcsncat) (wchar_t *, wchar_t const *,
+                                                   size_t)
+  = null_wcsncat;
 
 /* Test the library, not the compiler+library.  */
 static wchar_t *
@@ -43,11 +46,11 @@ lib_wcsncat (wchar_t *ws1, wchar_t const *ws2, size_t n)
 {
   return wcsncat (ws1, ws2, n);
 }
-static wchar_t *(*volatile volatile_wcsncat) (wchar_t *, wchar_t const *,
-                                              size_t)
+static wchar_t *(*volatile volatile_lib_wcsncat) (wchar_t *, wchar_t const *,
+                                                  size_t)
   = lib_wcsncat;
 #undef wcsncat
-#define wcsncat volatile_wcsncat
+#define wcsncat volatile_lib_wcsncat
 
 int
 main ()
@@ -63,8 +66,7 @@ main ()
     wchar_t y[2] = { L'x', 0 };
     ASSERT (wcsncat (y, NULL, 0) == y);
 
-    volatile_wcsncat = null_wcsncat;
-    ASSERT (wcsncat (y, NULL, 0) == y);
+    ASSERT (volatile_null_wcsncat (y, NULL, 0) == y);
   }
 
   return test_exit_status;
index 35c7a5ddd0818fb1d2320e2868755a721ee50432..0772925bbc736275cdbab89db85c7010592733ba 100644 (file)
@@ -36,6 +36,9 @@ null_wcsncmp (wchar_t const *ws1, wchar_t const *ws2, size_t n)
 #endif
   return r;
 }
+static int (*volatile volatile_null_wcsncmp) (wchar_t const *,
+                                              wchar_t const *, size_t)
+  = null_wcsncmp;
 
 /* Test the library, not the compiler+library.  */
 static int
@@ -43,11 +46,11 @@ lib_wcsncmp (wchar_t const *ws1, wchar_t const *ws2, size_t n)
 {
   return wcsncmp (ws1, ws2, n);
 }
-static int (*volatile volatile_wcsncmp) (wchar_t const *,
-                                         wchar_t const *, size_t)
+static int (*volatile volatile_lib_wcsncmp) (wchar_t const *,
+                                             wchar_t const *, size_t)
   = lib_wcsncmp;
 #undef wcsncmp
-#define wcsncmp volatile_wcsncmp
+#define wcsncmp volatile_lib_wcsncmp
 
 int
 main (int argc, char *argv[])
@@ -208,8 +211,7 @@ main (int argc, char *argv[])
   ASSERT (wcsncmp (L"x", NULL, 0) == 0);
   ASSERT (wcsncmp (NULL, NULL, 0) == 0);
 
-  volatile_wcsncmp = null_wcsncmp;
-  ASSERT (wcsncmp (NULL, L"x", 0) == 0);
+  ASSERT (volatile_null_wcsncmp (NULL, L"x", 0) == 0);
 
   return test_exit_status;
 }
index e5eb777baba329a1f35baf191491aec8410840b7..25bc00c7d9317f039a062111148a29965fadb26f 100644 (file)
@@ -34,6 +34,9 @@ null_wcsncpy (wchar_t *ws1, wchar_t const *ws2, size_t n)
 #endif
   return p;
 }
+static wchar_t *(*volatile volatile_null_wcsncpy) (wchar_t *, wchar_t const *,
+                                                   size_t)
+  = null_wcsncpy;
 
 /* Test the library, not the compiler+library.  */
 static wchar_t *
@@ -41,11 +44,11 @@ lib_wcsncpy (wchar_t *ws1, wchar_t const *ws2, size_t n)
 {
   return wcsncpy (ws1, ws2, n);
 }
-static wchar_t *(*volatile volatile_wcsncpy) (wchar_t *, wchar_t const *,
-                                              size_t)
+static wchar_t *(*volatile volatile_lib_wcsncpy) (wchar_t *, wchar_t const *,
+                                                  size_t)
   = lib_wcsncpy;
 #undef wcsncpy
-#define wcsncpy volatile_wcsncpy
+#define wcsncpy volatile_lib_wcsncpy
 
 int
 main (void)
@@ -59,8 +62,7 @@ main (void)
     wchar_t y[1];
     ASSERT (wcsncpy (y, NULL, 0) == y);
 
-    volatile_wcsncpy = null_wcsncpy;
-    ASSERT (wcsncpy (y, NULL, 0) == y);
+    ASSERT (volatile_null_wcsncpy (y, NULL, 0) == y);
   }
 
   return test_exit_status;
index 04858ba93ef4b70e50530f7aa6269e461e1f2abc..4b9f9eec7e2dedb973c660c8fcf5ae8ba49d4d64 100644 (file)
@@ -31,6 +31,9 @@ null_wmemchr (wchar_t const *s, wchar_t wc, size_t n)
   ASSERT (s == NULL);
   return (wchar_t *) p;
 }
+static wchar_t *(*volatile volatile_null_wmemchr) (wchar_t const *, wchar_t,
+                                                   size_t)
+  = null_wmemchr;
 
 /* Test the library, not the compiler+library.  */
 static wchar_t *
@@ -38,10 +41,11 @@ lib_wmemchr (wchar_t const *s, wchar_t wc, size_t n)
 {
   return (wchar_t *) wmemchr (s, wc, n);
 }
-static wchar_t *(*volatile volatile_wmemchr) (wchar_t const *, wchar_t, size_t)
+static wchar_t *(*volatile volatile_lib_wmemchr) (wchar_t const *, wchar_t,
+                                                  size_t)
   = lib_wmemchr;
 #undef wmemchr
-#define wmemchr volatile_wmemchr
+#define wmemchr volatile_lib_wmemchr
 
 int
 main (void)
@@ -50,8 +54,7 @@ main (void)
      <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
   ASSERT (wmemchr (NULL, L'?', 0) == NULL);
 
-  volatile_wmemchr = null_wmemchr;
-  ASSERT (wmemchr (NULL, L'?', 0) == NULL);
+  ASSERT (volatile_null_wmemchr (NULL, L'?', 0) == NULL);
 
   return test_exit_status;
 }
index 8d681960740dda8151a7c4d38dc1223b9435103b..030d7685f663ba8c8410dd79118fd29daa8dd49d 100644 (file)
@@ -33,6 +33,8 @@ null_wmemcmp (wchar_t const *ws1, wchar_t const *ws2, size_t n)
   ASSERT (ws1 == NULL);
   return r;
 }
+int (*volatile volatile_null_wmemcmp) (wchar_t const *, wchar_t const *, size_t)
+  = null_wmemcmp;
 
 /* Test the library, not the compiler+library.  */
 static int
@@ -40,10 +42,10 @@ lib_wmemcmp (wchar_t const *ws1, wchar_t const *ws2, size_t n)
 {
   return wmemcmp (ws1, ws2, n);
 }
-int (*volatile volatile_wmemcmp) (wchar_t const *, wchar_t const *, size_t)
+int (*volatile volatile_lib_wmemcmp) (wchar_t const *, wchar_t const *, size_t)
   = lib_wmemcmp;
 #undef wmemcmp
-#define wmemcmp volatile_wmemcmp
+#define wmemcmp volatile_lib_wmemcmp
 
 int
 main (int argc, char *argv[])
@@ -117,8 +119,7 @@ main (int argc, char *argv[])
   ASSERT (wmemcmp (L"x", NULL, 0) == 0);
   ASSERT (wmemcmp (NULL, NULL, 0) == 0);
 
-  volatile_wmemcmp = null_wmemcmp;
-  ASSERT (wmemcmp (NULL, L"x", 0) == 0);
+  ASSERT (volatile_null_wmemcmp (NULL, L"x", 0) == 0);
 
   return test_exit_status;
 }
index 296a0cae1e7695951f9453d423ef6b99eab3182a..9f4da1e424e424a6e837e57e1939adb50d06994f 100644 (file)
@@ -31,6 +31,9 @@ null_wmemcpy (wchar_t *s1, wchar_t const *s2, size_t n)
   ASSERT (s1 == NULL);
   return p;
 }
+static wchar_t *(*volatile volatile_null_wmemcpy) (wchar_t *, wchar_t const *,
+                                                   size_t)
+  = null_wmemcpy;
 
 /* Test the library, not the compiler+library.  */
 static wchar_t *
@@ -38,11 +41,11 @@ lib_wmemcpy (wchar_t *s1, wchar_t const *s2, size_t n)
 {
   return wmemcpy (s1, s2, n);
 }
-static wchar_t *(*volatile volatile_wmemcpy) (wchar_t *, wchar_t const *,
-                                              size_t)
+static wchar_t *(*volatile volatile_lib_wmemcpy) (wchar_t *, wchar_t const *,
+                                                  size_t)
   = lib_wmemcpy;
 #undef wmemcpy
-#define wmemcpy volatile_wmemcpy
+#define wmemcpy volatile_lib_wmemcpy
 
 int
 main (void)
@@ -57,8 +60,7 @@ main (void)
     ASSERT (wmemcpy (y, NULL, 0) == y);
   }
 
-  volatile_wmemcpy = null_wmemcpy;
-  ASSERT (wmemcpy (NULL, L"x", 0) == NULL);
+  ASSERT (volatile_null_wmemcpy (NULL, L"x", 0) == NULL);
 
   return test_exit_status;
 }
index 3737d62d98972b771cbb3600efed8b4ef194180b..f02be6b092a18928b22f3472ad4d6e875208187f 100644 (file)
@@ -31,6 +31,9 @@ null_wmemmove (wchar_t *s1, wchar_t const *s2, size_t n)
   ASSERT (s1 == NULL);
   return p;
 }
+static wchar_t *(*volatile volatile_null_wmemmove) (wchar_t *, wchar_t const *,
+                                                    size_t)
+  = null_wmemmove;
 
 /* Test the library, not the compiler+library.  */
 static wchar_t *
@@ -38,11 +41,11 @@ lib_wmemmove (wchar_t *s1, wchar_t const *s2, size_t n)
 {
   return wmemmove (s1, s2, n);
 }
-static wchar_t *(*volatile volatile_wmemmove) (wchar_t *, wchar_t const *,
-                                               size_t)
+static wchar_t *(*volatile volatile_lib_wmemmove) (wchar_t *, wchar_t const *,
+                                                   size_t)
   = lib_wmemmove;
 #undef wmemmove
-#define wmemmove volatile_wmemmove
+#define wmemmove volatile_lib_wmemmove
 
 int
 main (void)
@@ -57,8 +60,7 @@ main (void)
     ASSERT (wmemmove (y, NULL, 0) == y);
   }
 
-  volatile_wmemmove = null_wmemmove;
-  ASSERT (wmemmove (NULL, L"x", 0) == NULL);
+  ASSERT (volatile_null_wmemmove (NULL, L"x", 0) == NULL);
 
   return test_exit_status;
 }
index 9d45f4c5a69608f6711ef19128bc4bcea4d540ce..f12047aa10ad74daa9b3b63a971fa138d6c61dd5 100644 (file)
@@ -31,6 +31,8 @@ null_wmemset (wchar_t *ws, wchar_t wc, size_t n)
   ASSERT (ws == NULL);
   return p;
 }
+static wchar_t *(*volatile volatile_null_wmemset) (wchar_t *, wchar_t, size_t)
+  = null_wmemset;
 
 /* Test the library, not the compiler+library.  */
 static wchar_t *
@@ -38,10 +40,10 @@ lib_wmemset (wchar_t *ws, wchar_t wc, size_t n)
 {
   return wmemset (ws, wc, n);
 }
-static wchar_t *(*volatile volatile_wmemset) (wchar_t *, wchar_t, size_t)
+static wchar_t *(*volatile volatile_lib_wmemset) (wchar_t *, wchar_t, size_t)
   = lib_wmemset;
 #undef wmemset
-#define wmemset volatile_wmemset
+#define wmemset volatile_lib_wmemset
 
 int
 main (void)
@@ -50,8 +52,7 @@ main (void)
      <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
   ASSERT (wmemset (NULL, L'?', 0) == NULL);
 
-  volatile_wmemset = null_wmemset;
-  ASSERT (wmemset (NULL, L'?', 0) == NULL);
+  ASSERT (volatile_null_wmemset (NULL, L'?', 0) == NULL);
 
   return test_exit_status;
 }