]> Savannah Git Hosting - gnulib.git/commit
tests: dissuade unwanted clang optimization
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Nov 2024 22:55:32 +0000 (14:55 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 21 Nov 2024 01:11:45 +0000 (17:11 -0800)
commit15efa15b439ef092c28f1452f09b668604dbf68a
tree4c6f81ebb38de8063d3874f8e45adb28f9a48f04
parent131bc8e3fedd1df84fe8572be85d44f0223fc7b5
tests: dissuade unwanted clang optimization

Pacify Apple clang 14.0.0 (clang-1400.0.29.202) for
arm64-apple-darwin21.6.0 on test-memset_explicit.c,
which otherwise complains “warning: null passed to a callee that
requires a non-null argument [-Wnonnull]” and presumably could
do an unwanted optimization based on this analysis.
Do other tests consistently.
* tests/test-bsearch.c (lib_bsearch, volatile_bsearch, bsearch):
* tests/test-memccpy.c (lib_memccpy, volatile_memccpy, memccpy):
* tests/test-memchr.c (lib_memchr, volatile_memchr, memchr):
* tests/test-memcmp.c (lib_memcmp, volatile_memcmp, memcmp):
* tests/test-memcpy.c (lib_memcpy, volatile_memcpy, memcpy):
* tests/test-memmove.c (lib_memmove, volatile_memmove, memmove):
* tests/test-memset.c (lib_memset, volatile_memset, memset):
* tests/test-memset_explicit.c (lib_memset_explicit)
(volatile_memset_explicit, memset_explicit):
* tests/test-qsort.c (lib_qsort, volatile_qsort, qsort):
* tests/test-strncat.c (lib_strncat, volatile_strncat, strncat):
* tests/test-strncmp.c (lib_strncmp, volatile_strncmp, strncmp):
* tests/test-strncpy.c (lib_strncpy, volatile_strncpy, strncpy):
* tests/test-strndup.c (lib_strndup, volatile_strndup, strndup):
* tests/test-wcsncat.c (lib_wcsncat, volatile_wcsncat, wcsncat):
* tests/test-wcsncmp.c (lib_wcsncmp, volatile_wcsncmp, wcsncmp):
* tests/test-wcsncpy.c (lib_wcsncpy, volatile_wcsncpy, wcsncpy):
* tests/test-wmemchr.c (lib_wmemchr, volatile_wmemchr, wmemchr):
* tests/test-wmemcmp.c (lib_wmemcmp, volatile_wmemcmp, wmemcmp):
* tests/test-wmemcpy.c (lib_wmemcpy, volatile_wmemcpy, wmemcpy):
* tests/test-wmemmove.c (lib_wmemmove, volatile_wmemmove, wmemmove):
* tests/test-wmemset.c (lib_wmemset, volatile_wmemset, wmemset)
Convince the compiler to not optimize based on what it thinks
about the function.  Callers changed to not use volatile locals,
since they should no longer be needed.
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