1 | // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s |
2 | |
3 | // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 -o - %s |
4 | |
5 | void foo() { |
6 | } |
7 | |
8 | bool foobool(int argc) { |
9 | return argc; |
10 | } |
11 | |
12 | struct S1; // expected-note {{declared here}} expected-note {{declared here}} |
13 | |
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 | // CHECK: static T a; |
20 | |
21 | #pragma omp target |
22 | #pragma omp teams |
23 | #pragma omp distribute simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}} |
24 | for (int i = 0; i < 10; ++i) foo(); |
25 | |
26 | #pragma omp target |
27 | #pragma omp teams |
28 | #pragma omp distribute simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
29 | for (int i = 0; i < 10; ++i) foo(); |
30 | |
31 | #pragma omp target |
32 | #pragma omp teams |
33 | #pragma omp distribute simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} |
34 | for (int i = 0; i < 10; ++i) foo(); |
35 | |
36 | #pragma omp target |
37 | #pragma omp teams |
38 | #pragma omp distribute simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}} |
39 | for (int i = 0; i < 10; ++i) foo(); |
40 | |
41 | #pragma omp target |
42 | #pragma omp teams |
43 | #pragma omp distribute simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
44 | for (int i = 0; i < 10; ++i) foo(); |
45 | |
46 | #pragma omp target |
47 | #pragma omp teams |
48 | #pragma omp distribute simd dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} |
49 | for (int i = 0; i < 10; ++i) foo(); |
50 | |
51 | #pragma omp target |
52 | #pragma omp teams |
53 | #pragma omp distribute simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error2 {{expression must have integral or unscoped enumeration type, not 'char *'}} |
54 | for (int i = 0; i < 10; ++i) foo(); |
55 | |
56 | #pragma omp target |
57 | #pragma omp teams |
58 | #pragma omp distribute simd dist_schedule (static), dist_schedule (static, 1) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'dist_schedule' clause}} |
59 | for (int i = 0; i < 10; ++i) foo(); |
60 | #pragma omp target |
61 | #pragma omp teams |
62 | #pragma omp distribute simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}} |
63 | for (int i = 0; i < 10; ++i) foo(); |
64 | #pragma omp target |
65 | #pragma omp teams |
66 | #pragma omp 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 *'}} |
67 | for (int i = 0; i < 10; ++i) foo(); |
68 | return T(); |
69 | } |
70 | |
71 | int main(int argc, char **argv) { |
72 | #pragma omp target |
73 | #pragma omp teams |
74 | #pragma omp distribute simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}} |
75 | for (int i = 0; i < 10; ++i) foo(); |
76 | |
77 | #pragma omp target |
78 | #pragma omp teams |
79 | #pragma omp distribute simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
80 | for (int i = 0; i < 10; ++i) foo(); |
81 | |
82 | #pragma omp target |
83 | #pragma omp teams |
84 | #pragma omp distribute simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} |
85 | for (int i = 0; i < 10; ++i) foo(); |
86 | |
87 | #pragma omp target |
88 | #pragma omp teams |
89 | #pragma omp distribute simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}} |
90 | for (int i = 0; i < 10; ++i) foo(); |
91 | |
92 | #pragma omp target |
93 | #pragma omp teams |
94 | #pragma omp distribute simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
95 | for (int i = 0; i < 10; ++i) foo(); |
96 | |
97 | #pragma omp target |
98 | #pragma omp teams |
99 | #pragma omp distribute simd dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} |
100 | for (int i = 0; i < 10; ++i) foo(); |
101 | |
102 | #pragma omp target |
103 | #pragma omp teams |
104 | #pragma omp distribute simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} |
105 | for (int i = 0; i < 10; ++i) foo(); |
106 | |
107 | #pragma omp target |
108 | #pragma omp teams |
109 | #pragma omp distribute simd dist_schedule (static), dist_schedule (static, 1) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'dist_schedule' clause}} |
110 | for (int i = 0; i < 10; ++i) foo(); |
111 | |
112 | #pragma omp target |
113 | #pragma omp teams |
114 | #pragma omp distribute simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}} |
115 | for (int i = 0; i < 10; ++i) foo(); |
116 | |
117 | #pragma omp target |
118 | #pragma omp teams |
119 | #pragma omp 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 '('}} |
120 | for (int i = 0; i < 10; ++i) foo(); |
121 | 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}} |
122 | } |
123 | |