1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
8 bool foobool(int argc
) {
13 int cond
; // expected-note {{initialize the variable 'cond' to silence this warning}}
15 #pragma omp distribute simd if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
16 for (int i
= 0; i
< 10; ++i
)
20 struct S1
; // expected-note {{declared here}}
22 template <class T
, class S
> // expected-note {{declared here}}
23 int tmain(T argc
, S
**argv
) {
27 #pragma omp distribute simd if // expected-error {{expected '(' after 'if'}}
28 for (i
= 0; i
< argc
; ++i
) foo();
30 #pragma omp distribute simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
31 for (i
= 0; i
< argc
; ++i
) foo();
33 #pragma omp distribute simd if () // expected-error {{expected expression}}
34 for (i
= 0; i
< argc
; ++i
) foo();
36 #pragma omp distribute simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
37 for (i
= 0; i
< argc
; ++i
) foo();
39 #pragma omp distribute simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
40 for (i
= 0; i
< argc
; ++i
) foo();
42 #pragma omp distribute simd if (argc > 0 ? argv[1] : argv[2])
43 for (i
= 0; i
< argc
; ++i
) foo();
45 #pragma omp distribute simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'if' clause}}
46 for (i
= 0; i
< argc
; ++i
) foo();
48 #pragma omp distribute simd if (S) // expected-error {{'S' does not refer to a value}}
49 for (i
= 0; i
< argc
; ++i
) foo();
51 #pragma omp distribute simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
52 for (i
= 0; i
< argc
; ++i
) foo();
54 #pragma omp distribute simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
55 for (i
= 0; i
< argc
; ++i
) foo();
57 #pragma omp distribute simd if(argc + z)
58 for (i
= 0; i
< argc
; ++i
) foo();
60 #pragma omp distribute simd if(simd : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
61 for (i
= 0; i
< argc
; ++i
) foo();
63 #pragma omp distribute simd if(simd : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
64 for (i
= 0; i
< argc
; ++i
) foo();
66 #pragma omp distribute simd if(simd : argc)
67 for (i
= 0; i
< argc
; ++i
) foo();
69 #pragma omp distribute simd if(target : argc) // expected-error {{directive name modifier 'target' is not allowed for '#pragma omp distribute simd'}}
70 for (i
= 0; i
< argc
; ++i
) foo();
72 #pragma omp distribute simd if(simd : argc) if (simd :argc) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'if' clause with 'simd' name modifier}}
73 for (i
= 0; i
< argc
; ++i
) foo();
75 #pragma omp distribute simd if(simd : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{no more 'if' clause is allowed}}
76 for (i
= 0; i
< argc
; ++i
) foo();
81 int main(int argc
, char **argv
) {
84 #pragma omp distribute simd if // expected-error {{expected '(' after 'if'}}
85 for (i
= 0; i
< argc
; ++i
) foo();
87 #pragma omp distribute simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
88 for (i
= 0; i
< argc
; ++i
) foo();
90 #pragma omp distribute simd if () // expected-error {{expected expression}}
91 for (i
= 0; i
< argc
; ++i
) foo();
93 #pragma omp distribute simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
94 for (i
= 0; i
< argc
; ++i
) foo();
96 #pragma omp distribute simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
97 for (i
= 0; i
< argc
; ++i
) foo();
99 #pragma omp distribute simd if (argc > 0 ? argv[1] : argv[2])
100 for (i
= 0; i
< argc
; ++i
) foo();
102 #pragma omp distribute simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'if' clause}}
103 for (i
= 0; i
< argc
; ++i
) foo();
105 #pragma omp distribute simd if (S1) // expected-error {{'S1' does not refer to a value}}
106 for (i
= 0; i
< argc
; ++i
) foo();
108 #pragma omp distribute simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
109 for (i
= 0; i
< argc
; ++i
) foo();
111 #pragma omp distribute simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
112 for (i
= 0; i
< argc
; ++i
) foo();
114 #pragma omp distribute simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
115 for (i
= 0; i
< argc
; ++i
) foo();
117 #pragma omp distribute simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
118 for (i
= 0; i
< argc
; ++i
) foo();
120 #pragma omp distribute simd if(simd : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
121 for (i
= 0; i
< argc
; ++i
) foo();
123 #pragma omp distribute simd if(simd : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
124 for (i
= 0; i
< argc
; ++i
) foo();
126 #pragma omp distribute simd if(simd : argc + z) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp distribute simd'}}
127 for (i
= 0; i
< argc
; ++i
) foo();
129 #pragma omp distribute simd if(simd : argc) if (simd :argc) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'if' clause with 'simd' name modifier}}
130 for (i
= 0; i
< argc
; ++i
) foo();
132 #pragma omp distribute simd if(simd : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{no more 'if' clause is allowed}}
133 for (i
= 0; i
< argc
; ++i
) foo();
135 return tmain(argc
, argv
);