Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_teams_distribute_dist_schedule_messages.cpp
blob69c1e55eeaa3b857b4b9458b2ef49472c0ba6fa7
1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
5 void foo() {
8 bool foobool(int argc) {
9 return argc;
12 struct S1; // expected-note {{declared here}} expected-note {{declared here}}
14 template <class T, int N>
15 T tmain(T argc) {
16 T b = argc, c, d, e, f, g;
17 char ** argv;
18 static T a;
19 T z;
21 #pragma omp target teams distribute dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
22 for (int i = 0; i < 10; ++i) foo();
24 #pragma omp target teams distribute dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
25 for (int i = 0; i < 10; ++i) foo();
27 #pragma omp target teams distribute dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
28 for (int i = 0; i < 10; ++i) foo();
30 #pragma omp target teams distribute dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
31 for (int i = 0; i < 10; ++i) foo();
33 #pragma omp target teams distribute dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
34 for (int i = 0; i < 10; ++i) foo();
36 #pragma omp target teams distribute dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
37 for (int i = 0; i < 10; ++i) foo();
39 #pragma omp target teams distribute dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
40 for (int i = 0; i < 10; ++i) foo();
42 #pragma omp target teams distribute dist_schedule (static), dist_schedule (static, 1+z) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'dist_schedule' clause}}
43 for (int i = 0; i < 10; ++i) foo();
45 #pragma omp target teams distribute dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
46 for (int i = 0; i < 10; ++i) foo();
48 #pragma omp target teams distribute dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
49 for (int i = 0; i < 10; ++i) foo();
51 return T();
54 int main(int argc, char **argv) {
55 int z;
56 #pragma omp target teams distribute dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
57 for (int i = 0; i < 10; ++i) foo();
59 #pragma omp target teams distribute dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
60 for (int i = 0; i < 10; ++i) foo();
62 #pragma omp target teams distribute dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
63 for (int i = 0; i < 10; ++i) foo();
65 #pragma omp target teams distribute dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
66 for (int i = 0; i < 10; ++i) foo();
68 #pragma omp target teams distribute dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
69 for (int i = 0; i < 10; ++i) foo();
71 #pragma omp target teams distribute dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
72 for (int i = 0; i < 10; ++i) foo();
74 #pragma omp target teams distribute dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
75 for (int i = 0; i < 10; ++i) foo();
77 #pragma omp target teams distribute dist_schedule (static), dist_schedule (static, z+1) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'dist_schedule' clause}}
78 for (int i = 0; i < 10; ++i) foo();
80 #pragma omp target teams distribute dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
81 for (int i = 0; i < 10; ++i) foo();
83 #pragma omp target teams distribute dist_schedule (static, argv[1]=2) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
84 for (int i = 0; i < 10; ++i) foo();
86 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}}