1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp %s -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp-simd %s -Wuninitialized
10 bool foobool(int argc
) {
15 int cond
; // expected-note {{initialize the variable 'cond' to silence this warning}}
16 #pragma omp target simd if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
17 for (int i
= 0; i
< 10; ++i
)
21 struct S1
; // expected-note {{declared here}}
23 template <class T
, class S
> // expected-note {{declared here}}
24 int tmain(T argc
, S
**argv
) {
27 #pragma omp target simd if // expected-error {{expected '(' after 'if'}}
28 for (i
= 0; i
< argc
; ++i
) foo();
29 #pragma omp target simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
30 for (i
= 0; i
< argc
; ++i
) foo();
31 #pragma omp target simd if () // expected-error {{expected expression}}
32 for (i
= 0; i
< argc
; ++i
) foo();
33 #pragma omp target simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
34 for (i
= 0; i
< argc
; ++i
) foo();
35 #pragma omp target simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target simd' are ignored}}
36 for (i
= 0; i
< argc
; ++i
) foo();
37 #pragma omp target simd if (argc > 0 ? argv[1] : argv[2])
38 for (i
= 0; i
< argc
; ++i
) foo();
39 #pragma omp target simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target simd' cannot contain more than one 'if' clause}}
40 for (i
= 0; i
< argc
; ++i
) foo();
41 #pragma omp target simd if (S) // expected-error {{'S' does not refer to a value}}
42 for (i
= 0; i
< argc
; ++i
) foo();
43 #pragma omp target simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
44 for (i
= 0; i
< argc
; ++i
) foo();
45 #pragma omp target simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
46 for (i
= 0; i
< argc
; ++i
) foo();
47 #pragma omp target simd if(argc + z)
48 for (i
= 0; i
< argc
; ++i
) foo();
49 #pragma omp target simd if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
50 for (i
= 0; i
< argc
; ++i
) foo();
51 #pragma omp target simd if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
52 for (i
= 0; i
< argc
; ++i
) foo();
53 #pragma omp target simd if(target : argc)
54 for (i
= 0; i
< argc
; ++i
) foo();
55 #pragma omp target simd if(target : argc) if (simd:argc) // omp45-error {{directive name modifier 'simd' is not allowed for '#pragma omp target simd'}}
56 for (i
= 0; i
< argc
; ++i
) foo();
57 #pragma omp target simd if(target : argc) if (target :argc) // expected-error {{directive '#pragma omp target simd' cannot contain more than one 'if' clause with 'target' name modifier}}
58 for (i
= 0; i
< argc
; ++i
) foo();
59 #pragma omp target simd if(target : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} omp45-error {{no more 'if' clause is allowed}} omp51-error {{expected 'simd' directive name modifier}}
60 for (i
= 0; i
< argc
; ++i
) foo();
65 int main(int argc
, char **argv
) {
67 #pragma omp target simd if // expected-error {{expected '(' after 'if'}}
68 for (i
= 0; i
< argc
; ++i
) foo();
69 #pragma omp target simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
70 for (i
= 0; i
< argc
; ++i
) foo();
71 #pragma omp target simd if () // expected-error {{expected expression}}
72 for (i
= 0; i
< argc
; ++i
) foo();
73 #pragma omp target simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
74 for (i
= 0; i
< argc
; ++i
) foo();
75 #pragma omp target simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target simd' are ignored}}
76 for (i
= 0; i
< argc
; ++i
) foo();
77 #pragma omp target simd if (argc > 0 ? argv[1] : argv[2])
78 for (i
= 0; i
< argc
; ++i
) foo();
79 #pragma omp target simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target simd' cannot contain more than one 'if' clause}}
80 for (i
= 0; i
< argc
; ++i
) foo();
81 #pragma omp target simd if (S1) // expected-error {{'S1' does not refer to a value}}
82 for (i
= 0; i
< argc
; ++i
) foo();
83 #pragma omp target simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
84 for (i
= 0; i
< argc
; ++i
) foo();
85 #pragma omp target simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
86 for (i
= 0; i
< argc
; ++i
) foo();
87 #pragma omp target simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
88 for (i
= 0; i
< argc
; ++i
) foo();
89 #pragma omp target simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
90 for (i
= 0; i
< argc
; ++i
) foo();
91 #pragma omp target simd if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
92 for (i
= 0; i
< argc
; ++i
) foo();
93 #pragma omp target simd if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
94 for (i
= 0; i
< argc
; ++i
) foo();
95 #pragma omp target simd if(target : argc + z) if (simd:argc) // omp45-error {{directive name modifier 'simd' is not allowed for '#pragma omp target simd'}}
96 for (i
= 0; i
< argc
; ++i
) foo();
97 #pragma omp target simd if(target : argc) if (target :argc) // expected-error {{directive '#pragma omp target simd' cannot contain more than one 'if' clause with 'target' name modifier}}
98 for (i
= 0; i
< argc
; ++i
) foo();
99 #pragma omp target simd if(target : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} omp45-error {{no more 'if' clause is allowed}} omp51-error {{expected 'simd' directive name modifier}}
100 for (i
= 0; i
< argc
; ++i
) foo();
102 return tmain(argc
, argv
);