From 3dc99dbc82f8e07308c5d398136803e62f9676df Mon Sep 17 00:00:00 2001 From: Christopher Bazley Date: Tue, 22 Sep 2026 23:32:25 +0100 Subject: [PATCH] tests: account for Clang array qualifier behavior Clang doesn't combine qualifiers through array types so put a workaround into tcctest.c to avoid spurious failures of the recently-added tests for that operation, when using Clang instead of GCC to generate the reference output. --- tests/tcctest.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/tcctest.c b/tests/tcctest.c index 0d36b049..cc683ecb 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -3956,6 +3956,7 @@ void builtin_test(void) COMPAT_TYPE(int[2], const int[2]); COMPAT_TYPE(int[2][3], volatile int[][3]); COMPAT_TYPE(int (*)[], const int (*)[]); +#ifndef __clang__ COMPAT_TYPE(__typeof__(1 ? (const int (*)[2])0 : (int (*)[2])0), const int (*)[2]); COMPAT_TYPE(__typeof__(1 ? (const int (*)[2][3])0 : @@ -3964,6 +3965,12 @@ void builtin_test(void) COMPAT_TYPE(__typeof__(1 ? (volatile int (*)[2][3])0 : (const int (*)[2][3])0), const volatile int (*)[2][3]); +#else + /* clang doesn't combine qualifiers through array types */ + printf("__builtin_types_compatible_p(__typeof__(1 ? (const int (*)[2])0 : (int (*)[2])0), const int (*)[2]) = 1\n"); + printf("__builtin_types_compatible_p(__typeof__(1 ? (const int (*)[2][3])0 : (volatile int (*)[2][3])0), const volatile int (*)[2][3]) = 1\n"); + printf("__builtin_types_compatible_p(__typeof__(1 ? (volatile int (*)[2][3])0 : (const int (*)[2][3])0), const volatile int (*)[2][3]) = 1\n"); +#endif COMPAT_TYPE(int *, int *); COMPAT_TYPE(int *, void *); COMPAT_TYPE(int *, const int *);