1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
3 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
7 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel sections'}}
8 #pragma omp parallel sections
10 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel sections'}}
11 #pragma omp parallel sections foo
13 void test_no_clause(void) {
15 #pragma omp parallel sections
20 // expected-error@+2 {{the statement for '#pragma omp parallel sections' must be a compound statement}}
21 #pragma omp parallel sections
24 #pragma omp parallel sections
27 foo(); // expected-error {{statement in 'omp parallel sections' directive must be enclosed into a section region}}
32 void test_branch_protected_scope(void) {
39 #pragma omp parallel sections
42 goto L1
; // expected-error {{use of undeclared label 'L1'}}
44 return; // expected-error {{cannot return from OpenMP region}}
55 return; // expected-error {{cannot return from OpenMP region}}
65 goto L2
; // expected-error {{use of undeclared label 'L2'}}
68 goto L3
; // expected-error {{use of undeclared label 'L3'}}
71 void test_invalid_clause(void) {
73 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}}
74 #pragma omp parallel sections foo bar
77 // expected-error@+1 {{unexpected OpenMP clause 'nowait' in directive '#pragma omp section'}}
78 #pragma omp section nowait
83 void test_non_identifiers(void) {
86 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}}
87 #pragma omp parallel sections;
91 // expected-error@+2 {{unexpected OpenMP clause 'linear' in directive '#pragma omp parallel sections'}}
92 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}}
93 #pragma omp parallel sections linear(x);
98 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}}
99 #pragma omp parallel sections private(x);
104 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}}
105 #pragma omp parallel sections, private(x);
111 void test_private(void) {
113 // expected-error@+2 {{expected expression}}
114 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
115 #pragma omp parallel sections private(
119 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
120 // expected-error@+1 2 {{expected expression}}
121 #pragma omp parallel sections private(,
125 // expected-error@+1 2 {{expected expression}}
126 #pragma omp parallel sections private(, )
130 // expected-error@+1 {{expected expression}}
131 #pragma omp parallel sections private()
135 // expected-error@+1 {{expected expression}}
136 #pragma omp parallel sections private(int)
140 // expected-error@+1 {{expected variable name}}
141 #pragma omp parallel sections private(0)
147 #pragma omp parallel sections private(x)
151 #pragma omp parallel sections private(x, y)
155 #pragma omp parallel sections private(x, y, z)
161 void test_lastprivate(void) {
163 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
164 // expected-error@+1 {{expected expression}}
165 #pragma omp parallel sections lastprivate(
170 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
171 // expected-error@+1 2 {{expected expression}}
172 #pragma omp parallel sections lastprivate(,
176 // expected-error@+1 2 {{expected expression}}
177 #pragma omp parallel sections lastprivate(, )
181 // expected-error@+1 {{expected expression}}
182 #pragma omp parallel sections lastprivate()
186 // expected-error@+1 {{expected expression}}
187 #pragma omp parallel sections lastprivate(int)
191 // expected-error@+1 {{expected variable name}}
192 #pragma omp parallel sections lastprivate(0)
198 #pragma omp parallel sections lastprivate(x)
202 #pragma omp parallel sections lastprivate(x, y)
206 #pragma omp parallel sections lastprivate(x, y, z)
212 void test_firstprivate(void) {
214 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
215 // expected-error@+1 {{expected expression}}
216 #pragma omp parallel sections firstprivate(
221 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
222 // expected-error@+1 2 {{expected expression}}
223 #pragma omp parallel sections firstprivate(,
227 // expected-error@+1 2 {{expected expression}}
228 #pragma omp parallel sections firstprivate(, )
232 // expected-error@+1 {{expected expression}}
233 #pragma omp parallel sections firstprivate()
237 // expected-error@+1 {{expected expression}}
238 #pragma omp parallel sections firstprivate(int)
242 // expected-error@+1 {{expected variable name}}
243 #pragma omp parallel sections firstprivate(0)
249 #pragma omp parallel sections lastprivate(x) firstprivate(x)
253 #pragma omp parallel sections lastprivate(x, y) firstprivate(x, y)
257 #pragma omp parallel sections lastprivate(x, y, z) firstprivate(x, y, z)