From 177b1f4ba2780db1073654b5fdd39480492dab1b Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 4 Apr 2024 16:59:18 -0700 Subject: test: Use C23 keywords in test data Apparently 8120240c1f missed some. --- test/bitfield-unnamed-size-align.c | 4 ++-- test/cast-bool-char.c | 2 +- test/char-const-u8.c | 2 +- test/func-array-param.c | 9 +++++++++ test/func-array-param.qbe | 14 ++++++++++++++ test/global-align.c | 2 +- test/local-align.c | 2 +- test/nullptr.c | 2 +- test/static-assert-concat.c | 2 +- test/static-assert-struct.c | 2 +- test/string-u8-type.c | 2 +- 11 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 test/func-array-param.c create mode 100644 test/func-array-param.qbe (limited to 'test') diff --git a/test/bitfield-unnamed-size-align.c b/test/bitfield-unnamed-size-align.c index 505467b..87783f8 100644 --- a/test/bitfield-unnamed-size-align.c +++ b/test/bitfield-unnamed-size-align.c @@ -7,6 +7,6 @@ union u { char c; }; int s1 = sizeof(struct s); -int s2 = _Alignof(struct s); +int s2 = alignof(struct s); int u1 = sizeof(union u); -int u2 = _Alignof(union u); +int u2 = alignof(union u); diff --git a/test/cast-bool-char.c b/test/cast-bool-char.c index d05f575..3ce2325 100644 --- a/test/cast-bool-char.c +++ b/test/cast-bool-char.c @@ -1,3 +1,3 @@ int main(void) { - return (_Bool)(unsigned char)256; + return (bool)(unsigned char)256; } diff --git a/test/char-const-u8.c b/test/char-const-u8.c index 08d80e0..9f70d9a 100644 --- a/test/char-const-u8.c +++ b/test/char-const-u8.c @@ -1,3 +1,3 @@ unsigned char u8 = u8'a'; -_Static_assert(__builtin_types_compatible_p(typeof(u8'b'), unsigned char), +static_assert(__builtin_types_compatible_p(typeof(u8'b'), unsigned char), "UTF-8 character constant has incorrect type"); diff --git a/test/func-array-param.c b/test/func-array-param.c new file mode 100644 index 0000000..f57b8bd --- /dev/null +++ b/test/func-array-param.c @@ -0,0 +1,9 @@ +typedef int T1[]; +typedef const int T2[]; +void f(int a[const], const int b[], const T1 c, T2 d) { + /* check type of address, since __builtin_types_compatible_p ignores top-level qualifiers */ + static_assert(__builtin_types_compatible_p(typeof(&a), int *const*)); + static_assert(__builtin_types_compatible_p(typeof(&b), const int **)); + static_assert(__builtin_types_compatible_p(typeof(&c), const int **)); + static_assert(__builtin_types_compatible_p(typeof(&d), const int **)); +} diff --git a/test/func-array-param.qbe b/test/func-array-param.qbe new file mode 100644 index 0000000..84c6d7c --- /dev/null +++ b/test/func-array-param.qbe @@ -0,0 +1,14 @@ +export +function $f(l %.1, l %.3, l %.5, l %.7) { +@start.1 + %.2 =l alloc8 8 + storel %.1, %.2 + %.4 =l alloc8 8 + storel %.3, %.4 + %.6 =l alloc8 8 + storel %.5, %.6 + %.8 =l alloc8 8 + storel %.7, %.8 +@body.2 + ret +} diff --git a/test/global-align.c b/test/global-align.c index 9d35d91..cfcab18 100644 --- a/test/global-align.c +++ b/test/global-align.c @@ -1 +1 @@ -_Alignas(8) char c; +alignas(8) char c; diff --git a/test/local-align.c b/test/local-align.c index 8fc3736..952e49c 100644 --- a/test/local-align.c +++ b/test/local-align.c @@ -1,3 +1,3 @@ void f(void) { - _Alignas(16) char x[4]; + alignas(16) char x[4]; } diff --git a/test/nullptr.c b/test/nullptr.c index 8f5b436..498445a 100644 --- a/test/nullptr.c +++ b/test/nullptr.c @@ -1,4 +1,4 @@ typeof(nullptr) x = 0; -_Static_assert(sizeof x == sizeof(char *)); +static_assert(sizeof x == sizeof(char *)); int *y = nullptr; bool z = nullptr; diff --git a/test/static-assert-concat.c b/test/static-assert-concat.c index 7dd6f65..2290aa9 100644 --- a/test/static-assert-concat.c +++ b/test/static-assert-concat.c @@ -1 +1 @@ -_Static_assert(1, "abc" "def"); +static_assert(1, "abc" "def"); diff --git a/test/static-assert-struct.c b/test/static-assert-struct.c index 3b9f97d..f460d16 100644 --- a/test/static-assert-struct.c +++ b/test/static-assert-struct.c @@ -1,4 +1,4 @@ struct s { int x; - _Static_assert(1, ""); + static_assert(1, ""); }; diff --git a/test/string-u8-type.c b/test/string-u8-type.c index d7fe074..3270322 100644 --- a/test/string-u8-type.c +++ b/test/string-u8-type.c @@ -1 +1 @@ -_Static_assert(__builtin_types_compatible_p(__typeof__(u8"abc"), unsigned char[])); +static_assert(__builtin_types_compatible_p(__typeof__(u8"abc"), unsigned char[])); -- cgit v1.2.3