Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_teams_distribute_simd_if_messages.cpp
blob73e4bec5144a3db3325d841f1013aa05471dac7f
1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp -ferror-limit 100 %s -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
7 void foo() {
10 bool foobool(int argc) {
11 return argc;
14 void xxx(int argc) {
15 int cond; // expected-note {{initialize the variable 'cond' to silence this warning}}
16 #pragma omp target teams distribute 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) {
25 T i, z;
26 #pragma omp target teams distribute simd if // expected-error {{expected '(' after 'if'}}
27 for (i = 0; i < argc; ++i) foo();
28 #pragma omp target teams distribute simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
29 for (i = 0; i < argc; ++i) foo();
30 #pragma omp target teams distribute simd if () // expected-error {{expected expression}}
31 for (i = 0; i < argc; ++i) foo();
32 #pragma omp target teams distribute simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
33 for (i = 0; i < argc; ++i) foo();
34 #pragma omp target teams distribute simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
35 for (i = 0; i < argc; ++i) foo();
36 #pragma omp target teams distribute simd if (argc > 0 ? argv[1] : argv[2])
37 for (i = 0; i < argc; ++i) foo();
38 #pragma omp target teams distribute simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'if' clause}}
39 for (i = 0; i < argc; ++i) foo();
40 #pragma omp target teams distribute simd if (S) // expected-error {{'S' does not refer to a value}}
41 for (i = 0; i < argc; ++i) foo();
42 #pragma omp target teams distribute simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
43 for (i = 0; i < argc; ++i) foo();
44 #pragma omp target teams distribute simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
45 for (i = 0; i < argc; ++i) foo();
46 #pragma omp target teams distribute simd if(argc * z)
47 for (i = 0; i < argc; ++i) foo();
48 #pragma omp target teams distribute simd if(target // expected-error {{use of undeclared identifier 'target'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
49 for (i = 0; i < argc; ++i) foo();
50 #pragma omp target teams distribute simd if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
51 for (i = 0; i < argc; ++i) foo();
52 #pragma omp target teams distribute simd if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
53 for (i = 0; i < argc; ++i) foo();
54 #pragma omp target teams distribute simd if(target: argc)
55 for (i = 0; i < argc; ++i) foo();
56 #pragma omp target teams distribute simd if(target : argc) if (simd:argc) // omp45-error {{directive name modifier 'simd' is not allowed for '#pragma omp target teams distribute simd'}}
57 for (i = 0; i < argc; ++i) foo();
58 #pragma omp target teams distribute simd if(target: argc) if (target:argc) // expected-error {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'if' clause with 'target' name modifier}}
59 for (i = 0; i < argc; ++i) foo();
60 #pragma omp target teams distribute 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}}
61 for (i = 0; i < argc; ++i) foo();
62 #pragma omp target teams distribute simd if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute simd'}}
63 for (i = 0; i < argc; ++i) foo();
65 return 0;
68 int main(int argc, char **argv) {
69 int i, z;
70 #pragma omp target teams distribute simd if // expected-error {{expected '(' after 'if'}}
71 for (i = 0; i < argc; ++i) foo();
72 #pragma omp target teams distribute simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
73 for (i = 0; i < argc; ++i) foo();
74 #pragma omp target teams distribute simd if () // expected-error {{expected expression}}
75 for (i = 0; i < argc; ++i) foo();
76 #pragma omp target teams distribute simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
77 for (i = 0; i < argc; ++i) foo();
78 #pragma omp target teams distribute simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
79 for (i = 0; i < argc; ++i) foo();
80 #pragma omp target teams distribute simd if (argc > 0 ? argv[1] : argv[2])
81 for (i = 0; i < argc; ++i) foo();
82 #pragma omp target teams distribute simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'if' clause}}
83 for (i = 0; i < argc; ++i) foo();
84 #pragma omp target teams distribute simd if (S1) // expected-error {{'S1' does not refer to a value}}
85 for (i = 0; i < argc; ++i) foo();
86 #pragma omp target teams distribute simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
87 for (i = 0; i < argc; ++i) foo();
88 #pragma omp target teams distribute simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
89 for (i = 0; i < argc; ++i) foo();
90 #pragma omp target teams distribute simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
91 for (i = 0; i < argc; ++i) foo();
92 #pragma omp target teams distribute simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
93 for (i = 0; i < argc; ++i) foo();
94 #pragma omp target teams distribute simd if(target // expected-error {{use of undeclared identifier 'target'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
95 for (i = 0; i < argc; ++i) foo();
96 #pragma omp target teams distribute simd if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
97 for (i = 0; i < argc; ++i) foo();
98 #pragma omp target teams distribute simd if(target: argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
99 for (i = 0; i < argc; ++i) foo();
100 #pragma omp target teams distribute simd if(target: z/argc)
101 for (i = 0; i < argc; ++i) foo();
102 #pragma omp target teams distribute simd if(target : argc) if (simd:argc) // omp45-error {{directive name modifier 'simd' is not allowed for '#pragma omp target teams distribute simd'}}
103 for (i = 0; i < argc; ++i) foo();
104 #pragma omp target teams distribute simd if(target: argc) if (target:argc) // expected-error {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'if' clause with 'target' name modifier}}
105 for (i = 0; i < argc; ++i) foo();
106 #pragma omp target teams distribute 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}}
107 for (i = 0; i < argc; ++i) foo();
108 #pragma omp target teams distribute simd if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute simd'}}
109 for (i = 0; i < argc; ++i) foo();
111 return tmain(argc, argv);