1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
3 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
6 int x
; // expected-note {{initialize the variable 'x' to silence this warning}}
9 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
15 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp sections'}}
18 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp sections'}}
19 #pragma omp sections foo
21 void test_no_clause(void) {
28 // expected-error@+2 {{the statement for '#pragma omp sections' must be a compound statement}}
35 foo(); // expected-error {{statement in 'omp sections' directive must be enclosed into a section region}}
42 return; // expected-error {{cannot return from OpenMP region}}
47 return; // expected-error {{cannot return from OpenMP region}}
53 void test_branch_protected_scope(void) {
64 goto L1
; // expected-error {{use of undeclared label 'L1'}}
87 goto L1
; // expected-error {{use of undeclared label 'L1'}}
97 goto L2
; // expected-error {{use of undeclared label 'L2'}}
100 goto L3
; // expected-error {{use of undeclared label 'L3'}}
103 void test_invalid_clause(void) {
106 // expected-warning@+1 {{extra tokens at the end of '#pragma omp sections' are ignored}}
107 #pragma omp sections foo bar
110 // expected-error@+1 {{unexpected OpenMP clause 'nowait' in directive '#pragma omp section'}}
111 #pragma omp section nowait
116 void test_non_identifiers(void) {
120 // expected-warning@+1 {{extra tokens at the end of '#pragma omp sections' are ignored}}
121 #pragma omp sections;
126 // expected-error@+2 {{unexpected OpenMP clause 'linear' in directive '#pragma omp sections'}}
127 // expected-warning@+1 {{extra tokens at the end of '#pragma omp sections' are ignored}}
128 #pragma omp sections linear(x);
134 // expected-warning@+1 {{extra tokens at the end of '#pragma omp sections' are ignored}}
135 #pragma omp sections private(x);
141 // expected-warning@+1 {{extra tokens at the end of '#pragma omp sections' are ignored}}
142 #pragma omp sections, private(x);
148 void test_private(void) {
151 // expected-error@+2 {{expected expression}}
152 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
153 #pragma omp sections private(
158 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
159 // expected-error@+1 2 {{expected expression}}
160 #pragma omp sections private(,
165 // expected-error@+1 2 {{expected expression}}
166 #pragma omp sections private(, )
171 // expected-error@+1 {{expected expression}}
172 #pragma omp sections private()
177 // expected-error@+1 {{expected expression}}
178 #pragma omp sections private(int)
183 // expected-error@+1 {{expected variable name}}
184 #pragma omp sections private(0)
191 #pragma omp sections private(x)
196 #pragma omp sections private(x, y)
201 #pragma omp sections private(x, y, z)
207 void test_lastprivate(void) {
210 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
211 // expected-error@+1 {{expected expression}}
212 #pragma omp sections lastprivate(
218 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
219 // expected-error@+1 2 {{expected expression}}
220 #pragma omp sections lastprivate(,
225 // expected-error@+1 2 {{expected expression}}
226 #pragma omp sections lastprivate(, )
231 // expected-error@+1 {{expected expression}}
232 #pragma omp sections lastprivate()
237 // expected-error@+1 {{expected expression}}
238 #pragma omp sections lastprivate(int)
243 // expected-error@+1 {{expected variable name}}
244 #pragma omp sections lastprivate(0)
251 #pragma omp sections lastprivate(x)
256 #pragma omp sections lastprivate(x, y)
261 #pragma omp sections lastprivate(x, y, z)
267 void test_firstprivate(void) {
270 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
271 // expected-error@+1 {{expected expression}}
272 #pragma omp sections firstprivate(
278 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
279 // expected-error@+1 2 {{expected expression}}
280 #pragma omp sections firstprivate(,
285 // expected-error@+1 2 {{expected expression}}
286 #pragma omp sections firstprivate(, )
291 // expected-error@+1 {{expected expression}}
292 #pragma omp sections firstprivate()
297 // expected-error@+1 {{expected expression}}
298 #pragma omp sections firstprivate(int)
303 // expected-error@+1 {{expected variable name}}
304 #pragma omp sections firstprivate(0)
311 #pragma omp sections lastprivate(x) firstprivate(x)
316 #pragma omp sections lastprivate(x, y) firstprivate(x, y)
321 #pragma omp sections lastprivate(x, y, z) firstprivate(x, y, z)
327 void test_nowait(void) {
329 #pragma omp sections nowait nowait // expected-error {{directive '#pragma omp sections' cannot contain more than one 'nowait' clause}}