[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / distribute_parallel_for_dist_schedule_messages.cpp
blob07e7704dffded694783ae8d27efe67805ada0bce
1 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 -o - %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, z;
17 char ** argv;
18 static T a;
19 #pragma omp target
20 #pragma omp teams
21 #pragma omp distribute parallel for dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
22 for (int i = 0; i < 10; ++i) foo();
23 #pragma omp target
24 #pragma omp teams
25 #pragma omp distribute parallel for dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
26 for (int i = 0; i < 10; ++i) foo();
27 #pragma omp target
28 #pragma omp teams
29 #pragma omp distribute parallel for dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
30 for (int i = 0; i < 10; ++i) foo();
31 #pragma omp target
32 #pragma omp teams
33 #pragma omp distribute parallel for dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
34 for (int i = 0; i < 10; ++i) foo();
35 #pragma omp target
36 #pragma omp teams
37 #pragma omp distribute parallel for dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
38 for (int i = 0; i < 10; ++i) foo();
39 #pragma omp target
40 #pragma omp teams
41 #pragma omp distribute parallel for dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
42 for (int i = 0; i < 10; ++i) foo();
43 #pragma omp target
44 #pragma omp teams
45 #pragma omp distribute parallel for dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
46 for (int i = 0; i < 10; ++i) foo();
47 #pragma omp target
48 #pragma omp teams
49 #pragma omp distribute parallel for dist_schedule (static), dist_schedule (static, z+1) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'dist_schedule' clause}}
50 for (int i = 0; i < 10; ++i) foo();
51 #pragma omp target
52 #pragma omp teams
53 #pragma omp distribute parallel for dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
54 for (int i = 0; i < 10; ++i) foo();
55 #pragma omp target
56 #pragma omp teams
57 #pragma omp distribute parallel for 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 *'}}
58 for (int i = 0; i < 10; ++i) foo();
59 return T();
62 int main(int argc, char **argv) {
63 int z;
64 #pragma omp target
65 #pragma omp teams
66 #pragma omp distribute parallel for dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
67 for (int i = 0; i < 10; ++i) foo();
68 #pragma omp target
69 #pragma omp teams
70 #pragma omp distribute parallel for dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
71 for (int i = 0; i < 10; ++i) foo();
72 #pragma omp target
73 #pragma omp teams
74 #pragma omp distribute parallel for dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
75 for (int i = 0; i < 10; ++i) foo();
76 #pragma omp target
77 #pragma omp teams
78 #pragma omp distribute parallel for dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
79 for (int i = 0; i < 10; ++i) foo();
80 #pragma omp target
81 #pragma omp teams
82 #pragma omp distribute parallel for dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
83 for (int i = 0; i < 10; ++i) foo();
84 #pragma omp target
85 #pragma omp teams
86 #pragma omp distribute parallel for dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
87 for (int i = 0; i < 10; ++i) foo();
88 #pragma omp target
89 #pragma omp teams
90 #pragma omp distribute parallel for dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
91 for (int i = 0; i < 10; ++i) foo();
92 #pragma omp target
93 #pragma omp teams
94 #pragma omp distribute parallel for dist_schedule (static), dist_schedule (static, z+1) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'dist_schedule' clause}}
95 for (int i = 0; i < 10; ++i) foo();
96 #pragma omp target
97 #pragma omp teams
98 #pragma omp distribute parallel for dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
99 for (int i = 0; i < 10; ++i) foo();
100 #pragma omp target
101 #pragma omp teams
102 #pragma omp distribute parallel for 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 '('}}
103 for (int i = 0; i < 10; ++i) foo();
104 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}}