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}}
8 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
13 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp single'}}
16 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp single'}}
17 #pragma omp single foo
19 void test_no_clause(void) {
28 void test_branch_protected_scope(void) {
39 goto L1
; // expected-error {{use of undeclared label 'L1'}}
41 return; // expected-error {{cannot return from OpenMP region}}
51 goto L2
; // expected-error {{use of undeclared label 'L2'}}
56 void test_invalid_clause(void) {
59 // expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}
60 #pragma omp single foo bar
64 void test_non_identifiers(void) {
68 // expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}
72 // expected-error@+2 {{unexpected OpenMP clause 'linear' in directive '#pragma omp single'}}
73 // expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}
74 #pragma omp single linear(x);
78 // expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}
79 #pragma omp single private(x);
83 // expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}
84 #pragma omp single, private(x);
88 void test_private(void) {
91 // expected-error@+2 {{expected expression}}
92 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
93 #pragma omp single private(
96 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
97 // expected-error@+1 2 {{expected expression}}
98 #pragma omp single private(,
101 // expected-error@+1 2 {{expected expression}}
102 #pragma omp single private(, )
105 // expected-error@+1 {{expected expression}}
106 #pragma omp single private()
109 // expected-error@+1 {{expected expression}}
110 #pragma omp single private(int)
113 // expected-error@+1 {{expected variable name}}
114 #pragma omp single private(0)
119 #pragma omp single private(x)
122 #pragma omp single private(x, y)
125 #pragma omp single private(x, y, z)
129 void test_firstprivate(void) {
132 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
133 // expected-error@+1 {{expected expression}}
134 #pragma omp single firstprivate(
138 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
139 // expected-error@+1 2 {{expected expression}}
140 #pragma omp single firstprivate(,
143 // expected-error@+1 2 {{expected expression}}
144 #pragma omp single firstprivate(, )
147 // expected-error@+1 {{expected expression}}
148 #pragma omp single firstprivate()
151 // expected-error@+1 {{expected expression}}
152 #pragma omp single firstprivate(int)
155 // expected-error@+1 {{expected variable name}}
156 #pragma omp single firstprivate(0)
160 void test_nowait(void) {
161 #pragma omp single nowait nowait // expected-error {{directive '#pragma omp single' cannot contain more than one 'nowait' clause}}
162 for (int i
= 0; i
< 16; ++i
)