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@+1 {{expected '(' after 'schedule'}}
18 #pragma omp target teams distribute parallel for schedule
19 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
21 // expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
22 #pragma omp target teams distribute parallel for schedule (
23 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
25 // expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}
26 #pragma omp target teams distribute parallel for schedule ()
27 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
29 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
30 #pragma omp target teams distribute parallel for schedule (auto
31 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
33 // expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
34 #pragma omp target teams distribute parallel for schedule (auto_dynamic
35 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
37 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
38 #pragma omp target teams distribute parallel for schedule (auto,
39 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
41 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
42 #pragma omp target teams distribute parallel for schedule (runtime, 3)
43 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
45 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
46 #pragma omp target teams distribute parallel for schedule (guided argc
47 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
49 // expected-error@+1 2 {{argument to 'schedule' clause must be a strictly positive integer value}}
50 #pragma omp target teams distribute parallel for schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
51 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
53 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
54 #pragma omp target teams distribute parallel for schedule (dynamic, z+1))
55 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
57 #pragma omp target teams distribute parallel for schedule (guided, (ST > 0) ? 1 + ST : 2)
58 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
60 // expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'schedule' clause}}
61 // expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}}
62 #pragma omp target teams distribute parallel for schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5)
63 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
65 // expected-error@+1 {{'S' does not refer to a value}}
66 #pragma omp target teams distribute parallel for schedule (static, S)
67 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
69 // expected-error@+2 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
70 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
71 #pragma omp target teams distribute parallel for schedule (guided, argv[1]=2)
72 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
74 #pragma omp target teams distribute parallel for schedule (dynamic, 1)
75 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
77 // expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}}
78 #pragma omp target teams distribute parallel for schedule (static, N)
79 for (T i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
84 int main(int argc
, char **argv
) {
86 // expected-error@+1 {{expected '(' after 'schedule'}}
87 #pragma omp target teams distribute parallel for schedule
88 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
90 // expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
91 #pragma omp target teams distribute parallel for schedule (
92 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
94 // expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}
95 #pragma omp target teams distribute parallel for schedule ()
96 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
98 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
99 #pragma omp target teams distribute parallel for schedule (auto
100 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
102 // expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
103 #pragma omp target teams distribute parallel for schedule (auto_dynamic
104 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
106 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
107 #pragma omp target teams distribute parallel for schedule (auto,
108 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
110 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
111 #pragma omp target teams distribute parallel for schedule (runtime, 3)
112 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
114 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
115 #pragma omp target teams distribute parallel for schedule (guided, 4
116 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
118 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
119 #pragma omp target teams distribute parallel for schedule (static, 2+2 + z))
120 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
122 #pragma omp target teams distribute parallel for schedule (dynamic, foobool(1) > 0 ? 1 : 2)
123 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
125 // expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'schedule' clause}}
126 // expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}}
127 #pragma omp target teams distribute parallel for schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5)
128 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
130 // expected-error@+1 {{'S1' does not refer to a value}}
131 #pragma omp target teams distribute parallel for schedule (guided, S1)
132 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
134 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
135 // expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'char *'}}
136 #pragma omp target teams distribute parallel for schedule (static, argv[1]=2)
137 for (int i
= 4; i
< 12; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
139 // expected-error@+3 {{statement after '#pragma omp target teams distribute parallel for' must be a for loop}}
140 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
141 #pragma omp target teams distribute parallel for schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
144 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
145 return tmain
<int, char, 1, 0>(argc
, argv
);