1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
8 bool foobool(int argc
) {
13 int cond
; // expected-note {{initialize the variable 'cond' to silence this warning}}
14 #pragma omp distribute parallel for simd if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
15 for (int i
= 0; i
< 10; ++i
)
19 struct S1
; // expected-note {{declared here}}
21 template <class T
, class S
> // expected-note {{declared here}}
22 int tmain(T argc
, S
**argv
) {
26 #pragma omp distribute parallel for simd if // expected-error {{expected '(' after 'if'}}
27 for (i
= 0; i
< argc
; ++i
) foo();
30 #pragma omp distribute parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
31 for (i
= 0; i
< argc
; ++i
) foo();
34 #pragma omp distribute parallel for simd if () // expected-error {{expected expression}}
35 for (i
= 0; i
< argc
; ++i
) foo();
38 #pragma omp distribute parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
39 for (i
= 0; i
< argc
; ++i
) foo();
42 #pragma omp distribute parallel for simd if (k)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
43 for (i
= 0; i
< argc
; ++i
) foo();
46 #pragma omp distribute parallel for simd if (argc > 0 ? argv[1] : argv[2])
47 for (i
= 0; i
< argc
; ++i
) foo();
50 #pragma omp distribute parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'if' clause}}
51 for (i
= 0; i
< argc
; ++i
) foo();
54 #pragma omp distribute parallel for simd if (S) // expected-error {{'S' does not refer to a value}}
55 for (i
= 0; i
< argc
; ++i
) foo();
58 #pragma omp distribute parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
59 for (i
= 0; i
< argc
; ++i
) foo();
62 #pragma omp distribute parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
63 for (i
= 0; i
< argc
; ++i
) foo();
66 #pragma omp distribute parallel for simd if(argc)
67 for (i
= 0; i
< argc
; ++i
) foo();
70 #pragma omp distribute parallel for simd if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
71 for (i
= 0; i
< argc
; ++i
) foo();
74 #pragma omp distribute parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
75 for (i
= 0; i
< argc
; ++i
) foo();
78 #pragma omp distribute parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
79 for (i
= 0; i
< argc
; ++i
) foo();
82 #pragma omp distribute parallel for simd if(parallel : argc)
83 for (i
= 0; i
< argc
; ++i
) foo();
86 #pragma omp distribute parallel for simd if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp distribute parallel for simd'}}
87 for (i
= 0; i
< argc
; ++i
) foo();
90 #pragma omp distribute parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}}
91 for (i
= 0; i
< argc
; ++i
) foo();
94 #pragma omp distribute parallel for simd if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
95 for (i
= 0; i
< argc
; ++i
) foo();
98 #pragma omp distribute parallel for simd if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp distribute parallel for simd'}}
99 for (i
= 0; i
< argc
; ++i
) foo();
104 int main(int argc
, char **argv
) {
108 #pragma omp distribute parallel for simd if // expected-error {{expected '(' after 'if'}}
109 for (i
= 0; i
< argc
; ++i
) foo();
112 #pragma omp distribute parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
113 for (i
= 0; i
< argc
; ++i
) foo();
116 #pragma omp distribute parallel for simd if () // expected-error {{expected expression}}
117 for (i
= 0; i
< argc
; ++i
) foo();
120 #pragma omp distribute parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
121 for (i
= 0; i
< argc
; ++i
) foo();
124 #pragma omp distribute parallel for simd if (k)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
125 for (i
= 0; i
< argc
; ++i
) foo();
128 #pragma omp distribute parallel for simd if (argc > 0 ? argv[1] : argv[2])
129 for (i
= 0; i
< argc
; ++i
) foo();
132 #pragma omp distribute parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'if' clause}}
133 for (i
= 0; i
< argc
; ++i
) foo();
136 #pragma omp distribute parallel for simd if (S1) // expected-error {{'S1' does not refer to a value}}
137 for (i
= 0; i
< argc
; ++i
) foo();
140 #pragma omp distribute parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
141 for (i
= 0; i
< argc
; ++i
) foo();
144 #pragma omp distribute parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
145 for (i
= 0; i
< argc
; ++i
) foo();
148 #pragma omp distribute parallel for simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
149 for (i
= 0; i
< argc
; ++i
) foo();
152 #pragma omp distribute parallel for simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
153 for (i
= 0; i
< argc
; ++i
) foo();
156 #pragma omp distribute parallel for simd if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
157 for (i
= 0; i
< argc
; ++i
) foo();
160 #pragma omp distribute parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
161 for (i
= 0; i
< argc
; ++i
) foo();
164 #pragma omp distribute parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
165 for (i
= 0; i
< argc
; ++i
) foo();
168 #pragma omp distribute parallel for simd if(parallel : argc)
169 for (i
= 0; i
< argc
; ++i
) foo();
172 #pragma omp distribute parallel for simd if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp distribute parallel for simd'}}
173 for (i
= 0; i
< argc
; ++i
) foo();
176 #pragma omp distribute parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}}
177 for (i
= 0; i
< argc
; ++i
) foo();
180 #pragma omp distribute parallel for simd if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
181 for (i
= 0; i
< argc
; ++i
) foo();
184 #pragma omp distribute parallel for simd if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp distribute parallel for simd'}}
185 for (i
= 0; i
< argc
; ++i
) foo();
187 return tmain(argc
, argv
);