tests: account for Clang array qualifier behavior
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-arm64-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
build and test / test-i386-linux (push) Has been cancelled

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.
This commit is contained in:
Christopher Bazley 2026-09-22 23:32:25 +01:00
parent 0cd015b4ed
commit 3dc99dbc82

View File

@ -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 *);