From: Bruno Haible Date: Tue, 11 Aug 2026 20:35:08 +0000 (+0200) Subject: tests: Make last patch side-effect free. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8db20203684d9a287b5b287a52e6fe605eaaa576;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index fdc29cd9eb..11fe00ddfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2026-08-11 Bruno Haible + + 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 tests: Verify N3322 compatibility of the function prototypes. diff --git a/tests/test-bsearch.c b/tests/test-bsearch.c index 96df08b1ed..9cfdcfe3cb 100644 --- a/tests/test-bsearch.c +++ b/tests/test-bsearch.c @@ -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) . */ 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; } diff --git a/tests/test-memccpy.c b/tests/test-memccpy.c index 62a26b73bf..6f9e6d9c34 100644 --- a/tests/test-memccpy.c +++ b/tests/test-memccpy.c @@ -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; } diff --git a/tests/test-memchr.c b/tests/test-memchr.c index 1edde65eee..c125244a99 100644 --- a/tests/test-memchr.c +++ b/tests/test-memchr.c @@ -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) . */ 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; } diff --git a/tests/test-memcmp.c b/tests/test-memcmp.c index 30b99d2735..be68403159 100644 --- a/tests/test-memcmp.c +++ b/tests/test-memcmp.c @@ -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; } diff --git a/tests/test-memcpy.c b/tests/test-memcpy.c index cd82b80d9c..8d0fdfb88d 100644 --- a/tests/test-memcpy.c +++ b/tests/test-memcpy.c @@ -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; } diff --git a/tests/test-memmove.c b/tests/test-memmove.c index ef71b7c6fa..8709e9082f 100644 --- a/tests/test-memmove.c +++ b/tests/test-memmove.c @@ -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; } diff --git a/tests/test-memset.c b/tests/test-memset.c index 9e33fd947c..258d62754c 100644 --- a/tests/test-memset.c +++ b/tests/test-memset.c @@ -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) . */ 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; } diff --git a/tests/test-memset_explicit.c b/tests/test-memset_explicit.c index b9bafa1399..79f42a38c8 100644 --- a/tests/test-memset_explicit.c +++ b/tests/test-memset_explicit.c @@ -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 () . */ 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; } diff --git a/tests/test-qsort.c b/tests/test-qsort.c index 534a189876..9efbe53397 100644 --- a/tests/test-qsort.c +++ b/tests/test-qsort.c @@ -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; } diff --git a/tests/test-strncat.c b/tests/test-strncat.c index 7f542a3b37..2eeb46d77c 100644 --- a/tests/test-strncat.c +++ b/tests/test-strncat.c @@ -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; diff --git a/tests/test-strncmp.c b/tests/test-strncmp.c index 0108e6eb55..95ff26085a 100644 --- a/tests/test-strncmp.c +++ b/tests/test-strncmp.c @@ -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; } diff --git a/tests/test-strncpy.c b/tests/test-strncpy.c index 0c116bd9aa..80b79f4e0c 100644 --- a/tests/test-strncpy.c +++ b/tests/test-strncpy.c @@ -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; diff --git a/tests/test-strndup.c b/tests/test-strndup.c index 86ad433cfd..84c94184b6 100644 --- a/tests/test-strndup.c +++ b/tests/test-strndup.c @@ -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) . */ 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; } diff --git a/tests/test-wcsncat.c b/tests/test-wcsncat.c index 26f0168e47..f18f77a300 100644 --- a/tests/test-wcsncat.c +++ b/tests/test-wcsncat.c @@ -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; diff --git a/tests/test-wcsncmp.c b/tests/test-wcsncmp.c index 35c7a5ddd0..0772925bbc 100644 --- a/tests/test-wcsncmp.c +++ b/tests/test-wcsncmp.c @@ -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; } diff --git a/tests/test-wcsncpy.c b/tests/test-wcsncpy.c index e5eb777bab..25bc00c7d9 100644 --- a/tests/test-wcsncpy.c +++ b/tests/test-wcsncpy.c @@ -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; diff --git a/tests/test-wmemchr.c b/tests/test-wmemchr.c index 04858ba93e..4b9f9eec7e 100644 --- a/tests/test-wmemchr.c +++ b/tests/test-wmemchr.c @@ -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) . */ 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; } diff --git a/tests/test-wmemcmp.c b/tests/test-wmemcmp.c index 8d68196074..030d7685f6 100644 --- a/tests/test-wmemcmp.c +++ b/tests/test-wmemcmp.c @@ -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; } diff --git a/tests/test-wmemcpy.c b/tests/test-wmemcpy.c index 296a0cae1e..9f4da1e424 100644 --- a/tests/test-wmemcpy.c +++ b/tests/test-wmemcpy.c @@ -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; } diff --git a/tests/test-wmemmove.c b/tests/test-wmemmove.c index 3737d62d98..f02be6b092 100644 --- a/tests/test-wmemmove.c +++ b/tests/test-wmemmove.c @@ -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; } diff --git a/tests/test-wmemset.c b/tests/test-wmemset.c index 9d45f4c5a6..f12047aa10 100644 --- a/tests/test-wmemset.c +++ b/tests/test-wmemset.c @@ -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) . */ 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; }