[OpenACC] Treat 'delete' as a valid clause during parsing in C++ mode
[llvm-project.git] / clang / test / OpenMP / parallel_for_ordered_messages.cpp
blob3d6a8f267acb6454f22d6665ebb24aaafafc5480
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) {
22 #pragma omp parallel for ordered
23 for (int i = ST; i < N; i++)
24 argv[0][i] = argv[0][i] - argv[0][i - ST];
25 #pragma omp parallel for ordered( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
26 for (int i = ST; i < N; i++)
27 argv[0][i] = argv[0][i] - argv[0][i - ST];
28 #pragma omp parallel for ordered() // expected-error {{expected expression}}
29 for (int i = ST; i < N; i++)
30 argv[0][i] = argv[0][i] - argv[0][i - ST];
31 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
32 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
33 #pragma omp parallel for ordered(argc
34 for (int i = ST; i < N; i++)
35 argv[0][i] = argv[0][i] - argv[0][i - ST];
36 // expected-error@+1 2 {{argument to 'ordered' clause must be a strictly positive integer value}}
37 #pragma omp parallel for ordered(ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
38 for (int i = ST; i < N; i++)
39 argv[0][i] = argv[0][i] - argv[0][i - ST];
40 #pragma omp parallel for ordered(1)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
41 for (int i = ST; i < N; i++)
42 argv[0][i] = argv[0][i] - argv[0][i - ST];
43 #pragma omp parallel for ordered((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'ordered' clause}}
44 for (int i = ST; i < N; i++)
45 argv[0][i] = argv[0][i] - argv[0][i - ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp parallel for', but found only 1}}
46 // expected-error@+3 2 {{directive '#pragma omp parallel for' cannot contain more than one 'ordered' clause}}
47 // expected-error@+2 {{argument to 'ordered' clause must be a strictly positive integer value}}
48 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
49 #pragma omp parallel for ordered(foobool(argc)), ordered(true), ordered(-5)
50 for (int i = ST; i < N; i++)
51 argv[0][i] = argv[0][i] - argv[0][i - ST];
52 #pragma omp parallel for ordered(S) // expected-error {{'S' does not refer to a value}}
53 for (int i = ST; i < N; i++)
54 argv[0][i] = argv[0][i] - argv[0][i - ST];
55 #if __cplusplus <= 199711L
56 // expected-error@+4 2 {{integral constant expression}} expected-note@+4 0+{{constant expression}}
57 #else
58 // expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
59 #endif
60 #pragma omp parallel for ordered(argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
61 for (int i = ST; i < N; i++)
62 argv[0][i] = argv[0][i] - argv[0][i - ST];
63 #pragma omp parallel for ordered(1)
64 for (int i = ST; i < N; i++)
65 argv[0][i] = argv[0][i] - argv[0][i - ST];
66 #pragma omp parallel for ordered(N) // expected-error {{argument to 'ordered' clause must be a strictly positive integer value}}
67 for (T i = ST; i < N; i++)
68 argv[0][i] = argv[0][i] - argv[0][i - ST];
69 #pragma omp parallel for ordered(2) // expected-note {{as specified in 'ordered' clause}}
70 foo(); // expected-error {{expected 2 for loops after '#pragma omp parallel for'}}
71 return argc;
74 int main(int argc, char **argv) {
75 #pragma omp parallel for ordered
76 for (int i = 4; i < 12; i++)
77 argv[0][i] = argv[0][i] - argv[0][i - 4];
78 #pragma omp parallel for ordered( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
79 for (int i = 4; i < 12; i++)
80 argv[0][i] = argv[0][i] - argv[0][i - 4];
81 #pragma omp parallel for ordered() // expected-error {{expected expression}}
82 for (int i = 4; i < 12; i++)
83 argv[0][i] = argv[0][i] - argv[0][i - 4];
84 #pragma omp parallel for ordered(4 // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{as specified in 'ordered' clause}}
85 for (int i = 4; i < 12; i++)
86 argv[0][i] = argv[0][i] - argv[0][i - 4]; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}}
87 #pragma omp parallel for ordered(2 + 2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} expected-note {{as specified in 'ordered' clause}}
88 for (int i = 4; i < 12; i++)
89 argv[0][i] = argv[0][i] - argv[0][i - 4]; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}}
90 // expected-error@+1 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
91 #pragma omp parallel for ordered(foobool(1) > 0 ? 1 : 2)
92 for (int i = 4; i < 12; i++)
93 argv[0][i] = argv[0][i] - argv[0][i - 4];
94 // expected-error@+3 {{integral constant expression}} expected-note@+3 0+{{constant expression}}
95 // expected-error@+2 2 {{directive '#pragma omp parallel for' cannot contain more than one 'ordered' clause}}
96 // expected-error@+1 {{argument to 'ordered' clause must be a strictly positive integer value}}
97 #pragma omp parallel for ordered(foobool(argc)), ordered(true), ordered(-5)
98 for (int i = 4; i < 12; i++)
99 argv[0][i] = argv[0][i] - argv[0][i - 4];
100 #pragma omp parallel for ordered(S1) // expected-error {{'S1' does not refer to a value}}
101 for (int i = 4; i < 12; i++)
102 argv[0][i] = argv[0][i] - argv[0][i - 4];
103 #if __cplusplus <= 199711L
104 // expected-error@+4 {{integral constant expression}} expected-note@+4 0+{{constant expression}}
105 #else
106 // expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
107 #endif
108 #pragma omp parallel for ordered(argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
109 for (int i = 4; i < 12; i++)
110 argv[0][i] = argv[0][i] - argv[0][i - 4];
111 // expected-error@+3 {{statement after '#pragma omp parallel for' must be a for loop}}
112 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
113 #pragma omp parallel for ordered(ordered(tmain < int, char, -1, -2 > (argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
114 foo();
115 #pragma omp parallel for ordered(2) // expected-note {{as specified in 'ordered' clause}}
116 foo(); // expected-error {{expected 2 for loops after '#pragma omp parallel for'}}
117 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
118 return tmain<int, char, 1, 0>(argc, argv);