Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_teams_distribute_if_messages.cpp
blob321563002f53db9c9e851964f2e09dab1376935d
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
6 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
8 void foo() {
11 bool foobool(int argc) {
12 return argc;
15 void xxx(int argc) {
16 int cond; // expected-note {{initialize the variable 'cond' to silence this warning}}
17 #pragma omp target teams distribute 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) {
26 int i;
27 T z;
28 #pragma omp target teams distribute if // expected-error {{expected '(' after 'if'}}
29 for (i = 0; i < argc; ++i) foo();
31 #pragma omp target teams distribute if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
32 for (i = 0; i < argc; ++i) foo();
34 #pragma omp target teams distribute if () // expected-error {{expected expression}}
35 for (i = 0; i < argc; ++i) foo();
37 #pragma omp target teams distribute if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
38 for (i = 0; i < argc; ++i) foo();
40 #pragma omp target teams distribute if (z+argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
41 for (i = 0; i < argc; ++i) foo();
43 #pragma omp target teams distribute if (argc > 0 ? argv[1] : argv[2])
44 for (i = 0; i < argc; ++i) foo();
46 #pragma omp target teams distribute if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'if' clause}}
47 for (i = 0; i < argc; ++i) foo();
49 #pragma omp target teams distribute if (S) // expected-error {{'S' does not refer to a value}}
50 for (i = 0; i < argc; ++i) foo();
52 #pragma omp target teams distribute if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
53 for (i = 0; i < argc; ++i) foo();
55 #pragma omp target teams distribute if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
56 for (i = 0; i < argc; ++i) foo();
58 #pragma omp target teams distribute if(argc)
59 for (i = 0; i < argc; ++i) foo();
61 #pragma omp target teams distribute if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
62 for (i = 0; i < argc; ++i) foo();
64 #pragma omp target teams distribute if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
65 for (i = 0; i < argc; ++i) foo();
67 #pragma omp target teams distribute if(target : argc)
68 for (i = 0; i < argc; ++i) foo();
70 #pragma omp target teams distribute if(teams: argc) // expected-error {{directive name modifier 'teams' is not allowed for '#pragma omp target teams distribute'}}
71 for (i = 0; i < argc; ++i) foo();
73 #pragma omp target teams distribute if(distribute: argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}}
74 for (i = 0; i < argc; ++i) foo();
76 #pragma omp target teams distribute if(argc) if(teams: argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'teams' is not allowed for '#pragma omp target teams distribute'}} expected-error {{no more 'if' clause is allowed}}
77 for (i = 0; i < argc; ++i) foo();
79 #pragma omp target teams distribute if(argc) if(distribute: argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} expected-error {{no more 'if' clause is allowed}}
80 for (i = 0; i < argc; ++i) foo();
82 #pragma omp target teams distribute if(distribute: argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target teams distribute'}} expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}}
83 for (i = 0; i < argc; ++i) foo();
85 #pragma omp target teams distribute if(target : argc) if (target :argc) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'if' clause with 'target' name modifier}}
86 for (i = 0; i < argc; ++i) foo();
88 #pragma omp target teams distribute if(target : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{no more 'if' clause is allowed}}
89 for (i = 0; i < argc; ++i) foo();
91 #pragma omp target teams distribute if(target : argc) if(distribute: argc) if (argc) // expected-note 2 {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} expected-error {{expected one of directive name modifiers}}
92 for (i = 0; i < argc; ++i) foo();
94 return 0;
97 int main(int argc, char **argv) {
98 int i, z;
99 #pragma omp target teams distribute if // expected-error {{expected '(' after 'if'}}
100 for (i = 0; i < argc; ++i) foo();
102 #pragma omp target teams distribute if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
103 for (i = 0; i < argc; ++i) foo();
105 #pragma omp target teams distribute if () // expected-error {{expected expression}}
106 for (i = 0; i < argc; ++i) foo();
108 #pragma omp target teams distribute if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
109 for (i = 0; i < argc; ++i) foo();
111 #pragma omp target teams distribute if (argc+z)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
112 for (i = 0; i < argc; ++i) foo();
114 #pragma omp target teams distribute if (argc > 0 ? argv[1] : argv[2])
115 for (i = 0; i < argc; ++i) foo();
117 #pragma omp target teams distribute if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'if' clause}}
118 for (i = 0; i < argc; ++i) foo();
120 #pragma omp target teams distribute if (S1) // expected-error {{'S1' does not refer to a value}}
121 for (i = 0; i < argc; ++i) foo();
123 #pragma omp target teams distribute if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
124 for (i = 0; i < argc; ++i) foo();
126 #pragma omp target teams distribute if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
127 for (i = 0; i < argc; ++i) foo();
129 #pragma omp target teams distribute if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
130 for (i = 0; i < argc; ++i) foo();
132 #pragma omp target teams distribute if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
133 for (i = 0; i < argc; ++i) foo();
135 #pragma omp target teams distribute if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
136 for (i = 0; i < argc; ++i) foo();
138 #pragma omp target teams distribute if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
139 for (i = 0; i < argc; ++i) foo();
141 #pragma omp target teams distribute if(teams : argc) // expected-error {{directive name modifier 'teams' is not allowed for '#pragma omp target teams distribute'}}
142 for (i = 0; i < argc; ++i) foo();
144 #pragma omp target teams distribute if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}}
145 for (i = 0; i < argc; ++i) foo();
147 #pragma omp target teams distribute if(target : argc) if (distribute :argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}}
148 for (i = 0; i < argc; ++i) foo();
150 #pragma omp target teams distribute if(target : argc) if (target :argc) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'if' clause with 'target' name modifier}}
151 for (i = 0; i < argc; ++i) foo();
153 #pragma omp target teams distribute if(target : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
154 for (i = 0; i < argc; ++i) foo();
156 #pragma omp target teams distribute if(argc) if(teams: argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'teams' is not allowed for '#pragma omp target teams distribute'}} expected-error {{no more 'if' clause is allowed}}
157 for (i = 0; i < argc; ++i) foo();
159 #pragma omp target teams distribute if(argc) if(distribute: argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} expected-error {{no more 'if' clause is allowed}}
160 for (i = 0; i < argc; ++i) foo();
162 return tmain(argc, argv);