From 8ed72e7c1caa0eb4238e649063c26a11720935de Mon Sep 17 00:00:00 2001 From: jvoisin Date: Tue, 19 Mar 2024 18:35:13 +0100 Subject: Relax our checks for memchr on C11 and above Since C11: > This function behaves as if it reads the bytes sequentially and stops as soon as a matching bytes is found: if the array pointed to by ptr is smaller than count, but the match is found within the array, the behavior is well-defined. Reported-by: q66 --- tests/test_memchr_dynamic_read.c | 2 ++ tests/test_memchr_static_read.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/test_memchr_dynamic_read.c b/tests/test_memchr_dynamic_read.c index 2f8d214..8b25a15 100644 --- a/tests/test_memchr_dynamic_read.c +++ b/tests/test_memchr_dynamic_read.c @@ -3,6 +3,7 @@ #include int main(int argc, char** argv) { +#if __STDC_VERSION__ < 201112L const char* buffer = "12345"; memchr(buffer, (int)'4', strlen(buffer) - 1); puts(buffer); @@ -12,5 +13,6 @@ int main(int argc, char** argv) { CHK_FAIL_END puts(buffer); +#endif return ret; } diff --git a/tests/test_memchr_static_read.c b/tests/test_memchr_static_read.c index ccf46af..edd266d 100644 --- a/tests/test_memchr_static_read.c +++ b/tests/test_memchr_static_read.c @@ -3,6 +3,7 @@ #include int main(int argc, char** argv) { +#if __STDC_VERSION__ < 201112L const char* buffer = "12345"; const char* padding = "ABCDEFGHIJKLMN"; memchr(buffer, (int)'4', strlen(buffer) - 1); @@ -13,5 +14,6 @@ int main(int argc, char** argv) { CHK_FAIL_END puts(buffer); +#endif return ret; } -- cgit v1.3