xref: /llvm-project/clang/test/Sema/atomic-requires-library-error.c (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 %s -triple=i686-apple-darwin9 -verify
2 
3 struct foo {
4   int big[128];
5 };
6 struct bar {
7   char c[3];
8 };
9 
10 struct bar smallThing;
11 struct foo bigThing;
12 _Atomic(struct foo) bigAtomic;
13 
structAtomicStore(void)14 void structAtomicStore(void) {
15   struct foo f = {0};
16   __c11_atomic_store(&bigAtomic, f, 5); // expected-error {{atomic store requires runtime support that is not available for this target}}
17 
18   struct bar b = {0};
19   __atomic_store(&smallThing, &b, 5);
20 
21   __atomic_store(&bigThing, &f, 5);
22 }
23 
structAtomicLoad(void)24 void structAtomicLoad(void) {
25   struct foo f = __c11_atomic_load(&bigAtomic, 5); // expected-error {{atomic load requires runtime support that is not available for this target}}
26   struct bar b;
27   __atomic_load(&smallThing, &b, 5);
28 
29   __atomic_load(&bigThing, &f, 5);
30 }
31