]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c
testsuite: Refer more consistently to C23 not C2X
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / atomic / c2x-stdatomic-lockfree-char8_t.c
CommitLineData
703837b2
TH
1/* Test atomic_is_lock_free for char8_t. */
2/* { dg-do run } */
54bac0ce 3/* { dg-options "-std=c23 -pedantic-errors" } */
703837b2
TH
4
5#include <stdatomic.h>
6#include <stdint.h>
7
8extern void abort (void);
9
10_Atomic __CHAR8_TYPE__ ac8a;
11atomic_char8_t ac8t;
12
13#define CHECK_TYPE(MACRO, V1, V2) \
14 do \
15 { \
16 int r1 = MACRO; \
17 int r2 = atomic_is_lock_free (&V1); \
18 int r3 = atomic_is_lock_free (&V2); \
19 if (r1 != 0 && r1 != 1 && r1 != 2) \
20 abort (); \
21 if (r2 != 0 && r2 != 1) \
22 abort (); \
23 if (r3 != 0 && r3 != 1) \
24 abort (); \
25 if (r1 == 2 && r2 != 1) \
26 abort (); \
27 if (r1 == 2 && r3 != 1) \
28 abort (); \
29 if (r1 == 0 && r2 != 0) \
30 abort (); \
31 if (r1 == 0 && r3 != 0) \
32 abort (); \
33 } \
34 while (0)
35
36int
37main ()
38{
39 CHECK_TYPE (ATOMIC_CHAR8_T_LOCK_FREE, ac8a, ac8t);
40
41 return 0;
42}