1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
2
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
4
5 struct S1 { // expected-note 2 {{declared here}}
6 int a;
7 } s;
8
9 #pragma omp depobj(0) depend(in:s) // expected-error {{unexpected OpenMP directive '#pragma omp depobj'}}
foo()10 void foo() {
11 #pragma omp depobj(0) depend(in:s) // expected-error {{'omp_depend_t' type not found; include <omp.h>}} expected-error {{expected lvalue expression}}}
12 }
13
14 typedef void *omp_depend_t;
15
16 template <class T>
tmain(T argc)17 T tmain(T argc) {
18 omp_depend_t x;
19 #pragma omp depobj() allocate(argc) // expected-error {{expected expression}} expected-error {{expected depobj expression}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp depobj'}}
20 ;
21 #pragma omp depobj(x) untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp depobj'}}
22 #pragma omp depobj(x) unknown // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
23 if (argc)
24 #pragma omp depobj(x) destroy // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
25 if (argc) {
26 #pragma omp depobj(x) depend(in:s)
27 }
28 while (argc)
29 #pragma omp depobj(x)update(inout) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
30 while (argc) {
31 #pragma omp depobj(x) depend(in:s)
32 }
33 do
34 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
35 while (argc)
36 ;
37 do {
38 #pragma omp depobj(x) depend(in:s)
39 } while (argc);
40 switch (argc)
41 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
42 switch (argc)
43 case 1:
44 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
45 switch (argc)
46 case 1: {
47 #pragma omp depobj(x) depend(in:s)
48 }
49 switch (argc) {
50 #pragma omp depobj(x) depend(in:s)
51 case 1:
52 #pragma omp depobj(x) depend(in:s)
53 break;
54 default: {
55 #pragma omp depobj(x) depend(in:s)
56 } break;
57 }
58 for (;;)
59 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
60 for (;;) {
61 #pragma omp depobj(x) depend(in:s)
62 }
63 label:
64 #pragma omp depobj(x) depend(in:s)
65 label1 : {
66 #pragma omp depobj(x) depend(in:s)
67 }
68
69 #pragma omp depobj // expected-error {{expected depobj expression}}
70 #pragma omp depobj( // expected-error {{expected expression}} expected-error {{expected depobj expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
71 #pragma omp depobj() // expected-error {{expected expression}} expected-error {{expected depobj expression}}
72 #pragma omp depobj(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}}
73 #pragma omp depobj(argc, // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
74 #pragma omp depobj(argc) // expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
75 #pragma omp depobj(S1) // expected-error {{'S1' does not refer to a value}} expected-error {{expected depobj expression}}
76 #pragma omp depobj(argc) depobj(argc) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}}
77 #pragma omp parallel depobj(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
78 ;
79 return T();
80 }
81
main(int argc,char ** argv)82 int main(int argc, char **argv) {
83 omp_depend_t x;
84 #pragma omp depobj(x) depend(in:s)
85 ;
86 #pragma omp depobj(x) untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp depobj'}}
87 #pragma omp depobj(x) unknown // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
88 if (argc)
89 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
90 if (argc) {
91 #pragma omp depobj(x) depend(in:s)
92 }
93 while (argc)
94 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
95 while (argc) {
96 #pragma omp depobj(x) depend(in:s)
97 }
98 do
99 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
100 while (argc)
101 ;
102 do {
103 #pragma omp depobj(x) depend(in:s)
104 } while (argc);
105 switch (argc)
106 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
107 switch (argc)
108 case 1:
109 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
110 switch (argc)
111 case 1: {
112 #pragma omp depobj(x) depend(in:s)
113 }
114 switch (argc) {
115 #pragma omp depobj(x) depend(in:s)
116 case 1:
117 #pragma omp depobj(x) depend(in:s)
118 break;
119 default: {
120 #pragma omp depobj(x) depend(in:s)
121 } break;
122 }
123 for (;;)
124 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
125 for (;;) {
126 #pragma omp depobj(x) depend(in:s)
127 }
128 label:
129 #pragma omp depobj(x) depend(in:s)
130 label1 : {
131 #pragma omp depobj(x) depend(in:s)
132 }
133
134 #pragma omp depobj // expected-error {{expected depobj expression}}
135 #pragma omp depobj( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected depobj expression}}
136 #pragma omp depobj() // expected-error {{expected expression}} expected-error {{expected depobj expression}}
137 #pragma omp depobj(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
138 #pragma omp depobj(argc, // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
139 #pragma omp depobj(argc) // expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
140 #pragma omp depobj(S1) // expected-error {{'S1' does not refer to a value}} expected-error {{expected depobj expression}}
141 #pragma omp depobj(argc) depobj(argc) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
142 #pragma omp parallel depobj(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
143 ;
144 #pragma omp depobj(x) seq_cst // expected-error {{unexpected OpenMP clause 'seq_cst' in directive '#pragma omp depobj'}}
145 #pragma omp depobj(x) depend(source: x) // expected-error {{expected depend modifier(iterator) or 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}}
146 #pragma omp depobj(x) update // expected-error {{expected '(' after 'update'}}
147 #pragma omp depobj(x) update( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'update'}}
148 #pragma omp depobj(x) update(sink // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'update'}}
149 #pragma omp depobj(x) destroy destroy // expected-error {{directive '#pragma omp depobj' cannot contain more than one 'destroy' clause}}
150 #pragma omp depobj(x) update(in) update(in) // expected-error {{directive '#pragma omp depobj' cannot contain more than one 'update' clause}}
151 #pragma omp depobj(x) depend(in: argc) destroy // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
152 #pragma omp depobj(x) destroy depend(in: argc) // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
153 #pragma omp depobj(x) depend(in: argc) update(mutexinoutset) // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
154 #pragma omp depobj(x) update(inout) destroy // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
155 #pragma omp depobj(x) (x) depend(in: x) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
156 #pragma omp depobj(x) (x) update(in) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
157 #pragma omp depobj(x) depend(in: argc) depend(out:argc) // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
158 #pragma omp depend(out:x) depobj(x) // expected-error {{expected an OpenMP directive}}
159 #pragma omp destroy depobj(x) // expected-error {{expected an OpenMP directive}}
160 #pragma omp update(out) depobj(x) // expected-error {{expected an OpenMP directive}}
161 #pragma omp depobj depend(in:x) (x) // expected-error {{expected depobj expression}} expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}} expected-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}}
162 #pragma omp depobj destroy (x) // expected-error {{expected depobj expression}} expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
163 #pragma omp depobj update(in) (x) // expected-error {{expected depobj expression}} expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
164 return tmain(argc); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}}
165 }
166