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
5 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
6 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
11 bool foobool(int argc
) {
16 int cond
; // expected-note {{initialize the variable 'cond' to silence this warning}}
17 #pragma omp distribute parallel for if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
18 for (int i
= 0; i
< 10; ++i
)
22 struct S1
; // expected-note {{declared here}}
24 template <class T
, class S
> // expected-note {{declared here}}
25 int tmain(T argc
, S
**argv
) {
29 #pragma omp distribute parallel for if // expected-error {{expected '(' after 'if'}}
30 for (i
= 0; i
< argc
; ++i
) foo();
33 #pragma omp distribute parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
34 for (i
= 0; i
< argc
; ++i
) foo();
37 #pragma omp distribute parallel for if () // expected-error {{expected expression}}
38 for (i
= 0; i
< argc
; ++i
) foo();
41 #pragma omp distribute parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
42 for (i
= 0; i
< argc
; ++i
) foo();
45 #pragma omp distribute parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
46 for (i
= 0; i
< argc
; ++i
) foo();
49 #pragma omp distribute parallel for if (argc > 0 ? argv[1] : argv[2])
50 for (i
= 0; i
< argc
; ++i
) foo();
53 #pragma omp distribute parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'if' clause}}
54 for (i
= 0; i
< argc
; ++i
) foo();
57 #pragma omp distribute parallel for if (S) // expected-error {{'S' does not refer to a value}}
58 for (i
= 0; i
< argc
; ++i
) foo();
61 #pragma omp distribute parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
62 for (i
= 0; i
< argc
; ++i
) foo();
65 #pragma omp distribute parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
66 for (i
= 0; i
< argc
; ++i
) foo();
69 #pragma omp distribute parallel for if(argc+z)
70 for (i
= 0; i
< argc
; ++i
) foo();
73 #pragma omp distribute parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
74 for (i
= 0; i
< argc
; ++i
) foo();
77 #pragma omp distribute parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
78 for (i
= 0; i
< argc
; ++i
) foo();
81 #pragma omp distribute parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
82 for (i
= 0; i
< argc
; ++i
) foo();
85 #pragma omp distribute parallel for if(parallel : argc)
86 for (i
= 0; i
< argc
; ++i
) foo();
89 #pragma omp distribute parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp distribute parallel for'}}
90 for (i
= 0; i
< argc
; ++i
) foo();
93 #pragma omp distribute parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}}
94 for (i
= 0; i
< argc
; ++i
) foo();
97 #pragma omp distribute parallel for if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
98 for (i
= 0; i
< argc
; ++i
) foo();
101 #pragma omp distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp distribute parallel for'}}
102 for (i
= 0; i
< argc
; ++i
) foo();
107 int main(int argc
, char **argv
) {
111 #pragma omp distribute parallel for if // expected-error {{expected '(' after 'if'}}
112 for (i
= 0; i
< argc
; ++i
) foo();
115 #pragma omp distribute parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
116 for (i
= 0; i
< argc
; ++i
) foo();
119 #pragma omp distribute parallel for if () // expected-error {{expected expression}}
120 for (i
= 0; i
< argc
; ++i
) foo();
123 #pragma omp distribute parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
124 for (i
= 0; i
< argc
; ++i
) foo();
127 #pragma omp distribute parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
128 for (i
= 0; i
< argc
; ++i
) foo();
131 #pragma omp distribute parallel for if (argc > 0 ? argv[1] : argv[2])
132 for (i
= 0; i
< argc
; ++i
) foo();
135 #pragma omp distribute parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'if' clause}}
136 for (i
= 0; i
< argc
; ++i
) foo();
139 #pragma omp distribute parallel for if (S1) // expected-error {{'S1' does not refer to a value}}
140 for (i
= 0; i
< argc
; ++i
) foo();
143 #pragma omp distribute parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
144 for (i
= 0; i
< argc
; ++i
) foo();
147 #pragma omp distribute parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
148 for (i
= 0; i
< argc
; ++i
) foo();
151 #pragma omp distribute parallel for if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
152 for (i
= 0; i
< argc
; ++i
) foo();
155 #pragma omp distribute parallel for if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
156 for (i
= 0; i
< argc
; ++i
) foo();
159 #pragma omp distribute parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
160 for (i
= 0; i
< argc
; ++i
) foo();
163 #pragma omp distribute parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
164 for (i
= 0; i
< argc
; ++i
) foo();
167 #pragma omp distribute parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
168 for (i
= 0; i
< argc
; ++i
) foo();
171 #pragma omp distribute parallel for if(parallel : argc-z)
172 for (i
= 0; i
< argc
; ++i
) foo();
175 #pragma omp distribute parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp distribute parallel for'}}
176 for (i
= 0; i
< argc
; ++i
) foo();
179 #pragma omp distribute parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}}
180 for (i
= 0; i
< argc
; ++i
) foo();
183 #pragma omp distribute parallel for if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
184 for (i
= 0; i
< argc
; ++i
) foo();
187 #pragma omp distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp distribute parallel for'}}
188 for (i
= 0; i
< argc
; ++i
) foo();
190 return tmain(argc
, argv
);