1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
8 bool foobool(int argc
) {
12 struct S1
; // expected-note {{declared here}}
14 template <class T
, typename S
, int N
, int ST
> // expected-note {{declared here}}
15 T
tmain(T argc
, S
**argv
) {
17 // expected-error@+2 {{expected '(' after 'schedule'}}
19 #pragma omp teams distribute parallel for schedule
20 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
22 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
24 #pragma omp teams distribute parallel for schedule (
25 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
27 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}
29 #pragma omp teams distribute parallel for schedule ()
30 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
32 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
34 #pragma omp teams distribute parallel for schedule (auto
35 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
37 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
39 #pragma omp teams distribute parallel for schedule (auto_dynamic
40 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
42 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
44 #pragma omp teams distribute parallel for schedule (auto,
45 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
47 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
49 #pragma omp teams distribute parallel for schedule (runtime, 3)
50 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
52 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
54 #pragma omp teams distribute parallel for schedule (guided argc
55 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
57 // expected-error@+2 2 {{argument to 'schedule' clause must be a strictly positive integer value}}
59 #pragma omp teams distribute parallel for schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
60 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
62 // expected-warning@+2 {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
64 #pragma omp teams distribute parallel for schedule (dynamic, 1))
65 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
68 #pragma omp teams distribute parallel for schedule (guided, (ST > 0) ? 1 + ST : 2)
69 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
71 // expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'schedule' clause}}
72 // expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}
74 #pragma omp teams distribute parallel for schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5)
75 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
77 // expected-error@+2 {{'S' does not refer to a value}}
79 #pragma omp teams distribute parallel for schedule (static, S)
80 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
82 // expected-error@+3 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
83 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
85 #pragma omp teams distribute parallel for schedule (guided, argv[1]=2)
86 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
89 #pragma omp teams distribute parallel for schedule (dynamic, k)
90 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
92 // expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}
94 #pragma omp teams distribute parallel for schedule (static, N)
95 for (T i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
100 int main(int argc
, char **argv
) {
101 // expected-error@+2 {{expected '(' after 'schedule'}}
103 #pragma omp teams distribute parallel for schedule
104 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
106 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
108 #pragma omp teams distribute parallel for schedule (
109 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
111 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}
113 #pragma omp teams distribute parallel for schedule ()
114 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
116 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
118 #pragma omp teams distribute parallel for schedule (auto
119 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
121 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
123 #pragma omp teams distribute parallel for schedule (auto_dynamic
124 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
126 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
128 #pragma omp teams distribute parallel for schedule (auto,
129 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
131 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
133 #pragma omp teams distribute parallel for schedule (runtime, 3)
134 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
136 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
138 #pragma omp teams distribute parallel for schedule (guided, 4
139 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
141 // expected-warning@+2 {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
143 #pragma omp teams distribute parallel for schedule (static, 2+2))
144 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
147 #pragma omp teams distribute parallel for schedule (dynamic, foobool(1) > 0 ? 1 : 2)
148 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
150 // expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'schedule' clause}}
151 // expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}
153 #pragma omp teams distribute parallel for schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5)
154 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
156 // expected-error@+2 {{'S1' does not refer to a value}}
158 #pragma omp teams distribute parallel for schedule (guided, S1)
159 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
161 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
162 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
164 #pragma omp teams distribute parallel for schedule (static, argv[1]=2)
165 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
167 // expected-error@+4 {{statement after '#pragma omp teams distribute parallel for' must be a for loop}}
168 // expected-note@+2 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
170 #pragma omp teams distribute parallel for schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
173 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
174 return tmain
<int, char, 1, 0>(argc
, argv
);