Clang Project

clang_source_code/test/OpenMP/target_teams_distribute_simd_dist_schedule_messages.cpp
1// RUN: %clang_cc1 -verify -fopenmp %s
2
3// RUN: %clang_cc1 -verify -fopenmp-simd %s
4
5void foo() {
6}
7
8bool foobool(int argc) {
9  return argc;
10}
11
12struct S1; // expected-note {{declared here}} expected-note {{declared here}}
13
14template <class T, int N>
15T tmain(T argc) {
16  T b = argc, c, d, e, f, g;
17  char ** argv;
18  static T a;
19// CHECK: static T a;
20
21#pragma omp target teams distribute simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
22  for (int i = 0; i < 10; ++i) foo();
23
24#pragma omp target teams distribute simd 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();
26
27#pragma omp target teams distribute simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
28  for (int i = 0; i < 10; ++i) foo();
29
30#pragma omp target teams distribute simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
31  for (int i = 0; i < 10; ++i) foo();
32
33#pragma omp target teams distribute simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
34  for (int i = 0; i < 10; ++i) foo();
35
36#pragma omp target teams distribute simd 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 simd' are ignored}}
37  for (int i = 0; i < 10; ++i) foo();
38
39#pragma omp target teams distribute simd 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();
41
42#pragma omp target teams distribute simd dist_schedule (static), dist_schedule (static, 1) // expected-error {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'dist_schedule' clause}}
43  for (int i = 0; i < 10; ++i) foo();
44
45#pragma omp target teams distribute simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
46  for (int i = 0; i < 10; ++i) foo();
47
48#pragma omp target teams distribute simd 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();
50
51  return T();
52}
53
54int main(int argc, char **argv) {
55#pragma omp target teams distribute simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
56  for (int i = 0; i < 10; ++i) foo();
57
58#pragma omp target teams distribute simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
59  for (int i = 0; i < 10; ++i) foo();
60
61#pragma omp target teams distribute simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
62  for (int i = 0; i < 10; ++i) foo();
63
64#pragma omp target teams distribute simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
65  for (int i = 0; i < 10; ++i) foo();
66
67#pragma omp target teams distribute simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
68  for (int i = 0; i < 10; ++i) foo();
69
70#pragma omp target teams distribute simd 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 simd' are ignored}}
71  for (int i = 0; i < 10; ++i) foo();
72
73#pragma omp target teams distribute simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
74  for (int i = 0; i < 10; ++i) foo();
75
76#pragma omp target teams distribute simd dist_schedule (static), dist_schedule (static, 1) // expected-error {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'dist_schedule' clause}}
77  for (int i = 0; i < 10; ++i) foo();
78
79#pragma omp target teams distribute simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
80  for (int i = 0; i < 10; ++i) foo();
81
82#pragma omp target teams distribute simd 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 '('}}
83  for (int i = 0; i < 10; ++i) foo();
84
85  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}}
86}
87