| /* Test atomic_is_lock_free for char8_t. */ |
| /* { dg-do run } */ |
| /* { dg-options "-std=c23 -pedantic-errors" } */ |
| |
| #include <stdatomic.h> |
| #include <stdint.h> |
| |
| extern void abort (void); |
| |
| _Atomic __CHAR8_TYPE__ ac8a; |
| atomic_char8_t ac8t; |
| |
| #define CHECK_TYPE(MACRO, V1, V2) \ |
| do \ |
| { \ |
| int r1 = MACRO; \ |
| int r2 = atomic_is_lock_free (&V1); \ |
| int r3 = atomic_is_lock_free (&V2); \ |
| if (r1 != 0 && r1 != 1 && r1 != 2) \ |
| abort (); \ |
| if (r2 != 0 && r2 != 1) \ |
| abort (); \ |
| if (r3 != 0 && r3 != 1) \ |
| abort (); \ |
| if (r1 == 2 && r2 != 1) \ |
| abort (); \ |
| if (r1 == 2 && r3 != 1) \ |
| abort (); \ |
| if (r1 == 0 && r2 != 0) \ |
| abort (); \ |
| if (r1 == 0 && r3 != 0) \ |
| abort (); \ |
| } \ |
| while (0) |
| |
| int |
| main () |
| { |
| CHECK_TYPE (ATOMIC_CHAR8_T_LOCK_FREE, ac8a, ac8t); |
| |
| return 0; |
| } |