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