[OpenACC] Treat 'delete' as a valid clause during parsing in C++ mode
[llvm-project.git] / clang / test / OpenMP / distribute_simd_simdlen_messages.cpp
blob8c3c009c2a81377a10e8d6d2f9fd104fbfe6bcd0
1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
2 // RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
6 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized
7 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized
9 // expected-note@* 0+{{declared here}}
11 void foo() {
14 bool foobool(int argc) {
15 return argc;
18 struct S1;
20 template <class T, typename S, int N, int ST>
21 T tmain(T argc, S **argv) {
23 #pragma omp target
24 #pragma omp teams
25 #pragma omp distribute simd safelen // expected-error {{expected '(' after 'safelen'}}
26 for (int i = ST; i < N; i++)
27 argv[0][i] = argv[0][i] - argv[0][i-ST];
29 #pragma omp target
30 #pragma omp teams
31 #pragma omp distribute simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
32 for (int i = ST; i < N; i++)
33 argv[0][i] = argv[0][i] - argv[0][i-ST];
35 #pragma omp target
36 #pragma omp teams
37 #pragma omp distribute simd safelen () // expected-error {{expected expression}}
38 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
40 #pragma omp target
41 #pragma omp teams
42 #pragma omp distribute simd safelen (argc // expected-note {{to match this '('}} expected-error 2 {{integral constant expression}} expected-note 0+{{constant expression}} expected-error {{expected ')'}}
43 for (int i = ST; i < N; i++)
44 argv[0][i] = argv[0][i] - argv[0][i-ST];
46 #pragma omp target
47 #pragma omp teams
48 #pragma omp distribute simd safelen (ST // expected-error {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error {{expected ')'}} expected-note {{to match this '('}}
49 for (int i = ST; i < N; i++)
50 argv[0][i] = argv[0][i] - argv[0][i-ST];
52 #pragma omp target
53 #pragma omp teams
54 #pragma omp distribute simd safelen (1)) // expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
55 for (int i = ST; i < N; i++)
56 argv[0][i] = argv[0][i] - argv[0][i-ST];
58 #pragma omp target
59 #pragma omp teams
60 #pragma omp distribute simd safelen ((ST > 0) ? 1 + ST : 2)
61 for (int i = ST; i < N; i++)
62 argv[0][i] = argv[0][i] - argv[0][i-ST];
64 #pragma omp target
65 #pragma omp teams
66 // expected-error@+3 2 {{directive '#pragma omp distribute simd' cannot contain more than one 'safelen' clause}}
67 // expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}}
68 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
69 #pragma omp distribute simd safelen (foobool(argc)), safelen (true), safelen (-5)
70 for (int i = ST; i < N; i++)
71 argv[0][i] = argv[0][i] - argv[0][i-ST];
73 #pragma omp target
74 #pragma omp teams
75 #pragma omp distribute simd safelen (S) // expected-error {{'S' does not refer to a value}}
76 for (int i = ST; i < N; i++)
77 argv[0][i] = argv[0][i] - argv[0][i-ST];
79 #if __cplusplus <= 199711L
80 // expected-error@+6 2 {{integral constant expression}} expected-note@+6 0+{{constant expression}}
81 #else
82 // expected-error@+4 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
83 #endif
84 #pragma omp target
85 #pragma omp teams
86 #pragma omp distribute simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
87 for (int i = ST; i < N; i++)
88 argv[0][i] = argv[0][i] - argv[0][i-ST];
90 #pragma omp target
91 #pragma omp teams
92 #pragma omp distribute simd safelen (4)
93 for (int i = ST; i < N; i++)
94 argv[0][i] = argv[0][i] - argv[0][i-ST];
96 #pragma omp target
97 #pragma omp teams
98 #pragma omp distribute simd safelen (N) // expected-error {{argument to 'safelen' clause must be a strictly positive integer value}}
99 for (T i = ST; i < N; i++)
100 argv[0][i] = argv[0][i] - argv[0][i-ST];
102 return argc;
105 int main(int argc, char **argv) {
106 #pragma omp target
107 #pragma omp teams
108 #pragma omp parallel for simd safelen // expected-error {{expected '(' after 'safelen'}}
109 for (int i = 4; i < 12; i++)
110 argv[0][i] = argv[0][i] - argv[0][i-4];
112 #pragma omp target
113 #pragma omp teams
114 #pragma omp parallel for simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
115 for (int i = 4; i < 12; i++)
116 argv[0][i] = argv[0][i] - argv[0][i-4];
118 #pragma omp target
119 #pragma omp teams
120 #pragma omp parallel for simd safelen () // expected-error {{expected expression}}
121 for (int i = 4; i < 12; i++)
122 argv[0][i] = argv[0][i] - argv[0][i-4];
124 #pragma omp target
125 #pragma omp teams
126 #pragma omp parallel for simd safelen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
127 for (int i = 4; i < 12; i++)
128 argv[0][i] = argv[0][i] - argv[0][i-4];
130 #pragma omp target
131 #pragma omp teams
132 #pragma omp parallel for simd safelen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
133 for (int i = 4; i < 12; i++)
134 argv[0][i] = argv[0][i] - argv[0][i-4];
137 #pragma omp target
138 #pragma omp teams
139 #pragma omp parallel for simd safelen (foobool(1) > 0 ? 1 : 2) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
140 for (int i = 4; i < 12; i++)
141 argv[0][i] = argv[0][i] - argv[0][i-4];
143 #pragma omp target
144 #pragma omp teams
145 // expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}}
146 // expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}}
147 // expected-error@+1 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
148 #pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5)
149 for (int i = 4; i < 12; i++)
150 argv[0][i] = argv[0][i] - argv[0][i-4];
152 #pragma omp target
153 #pragma omp teams
154 #pragma omp parallel for simd safelen (S1) // expected-error {{'S1' does not refer to a value}}
155 for (int i = 4; i < 12; i++)
156 argv[0][i] = argv[0][i] - argv[0][i-4];
158 #if __cplusplus <= 199711L
159 // expected-error@+6 {{integral constant expression}} expected-note@+6 0+{{constant expression}}
160 #else
161 // expected-error@+4 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
162 #endif
163 #pragma omp target
164 #pragma omp teams
165 #pragma omp distribute simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
166 for (int i = 4; i < 12; i++)
167 argv[0][i] = argv[0][i] - argv[0][i-4];
169 // expected-note@+3 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
170 #pragma omp target
171 #pragma omp teams
172 #pragma omp distribute simd safelen(safelen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
173 foo(); // expected-error {{statement after '#pragma omp distribute simd' must be a for loop}}
175 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
176 return tmain<int, char, 12, 4>(argc, argv);