[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / OpenMP / target_parallel_for_simd_ordered_messages.cpp
blob8dd7f68c25fd887c79a28094f141208487557e43
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 int j;
23 #pragma omp target parallel for simd ordered
24 for (int i = ST; i < N; i++)
25 argv[0][i] = argv[0][i] - argv[0][i - ST];
26 #pragma omp target parallel for simd ordered( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27 for (int i = ST; i < N; i++)
28 argv[0][i] = argv[0][i] - argv[0][i - ST];
29 #pragma omp target parallel for simd ordered() // expected-error {{expected expression}}
30 for (int i = ST; i < N; i++)
31 argv[0][i] = argv[0][i] - argv[0][i - ST];
32 // expected-error@+2 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
33 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
34 #pragma omp target parallel for simd ordered(argc
35 for (int i = ST; i < N; i++)
36 argv[0][i] = argv[0][i] - argv[0][i - ST];
37 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
38 #pragma omp target parallel for simd ordered(ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
39 for (int i = ST; i < N; i++)
40 argv[0][i] = argv[0][i] - argv[0][i - ST];
41 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
42 #pragma omp target parallel for simd ordered(1)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel for simd' are ignored}}
43 for (int i = ST; i < N; i++)
44 argv[0][i] = argv[0][i] - argv[0][i - ST];
45 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
46 #pragma omp target parallel for simd ordered((ST > 0) ? 1 + ST : 2)
47 for (int i = ST; i < N; i++)
48 argv[0][i] = argv[0][i] - argv[0][i - ST];
49 // expected-error@+3 {{argument to 'ordered' clause must be a strictly positive integer value}}
50 // expected-error@+2 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'ordered' clause}}
51 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
52 #pragma omp target parallel for simd ordered(foobool(argc)), ordered(true), ordered(-5)
53 for (int i = ST; i < N; i++)
54 argv[0][i] = argv[0][i] - argv[0][i - ST];
55 #pragma omp target parallel for simd ordered(S) // expected-error {{'S' does not refer to a value}}
56 for (int i = ST; i < N; i++)
57 argv[0][i] = argv[0][i] - argv[0][i - ST];
59 // expected-error@+1 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
60 #pragma omp target parallel for simd ordered(j = 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 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
64 #pragma omp target parallel for simd ordered(1)
65 for (int i = ST; i < N; i++)
66 argv[0][i] = argv[0][i] - argv[0][i - ST];
67 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
68 #pragma omp target parallel for simd ordered(N)
69 for (T i = ST; i < N; i++)
70 argv[0][i] = argv[0][i] - argv[0][i - ST];
71 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
72 #pragma omp target parallel for simd ordered(2)
73 foo();
74 return argc;
77 int main(int argc, char **argv) {
78 int j;
79 #pragma omp target parallel for simd ordered
80 for (int i = 4; i < 12; i++)
81 argv[0][i] = argv[0][i] - argv[0][i - 4];
82 #pragma omp target parallel for simd ordered( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
83 for (int i = 4; i < 12; i++)
84 argv[0][i] = argv[0][i] - argv[0][i - 4];
85 #pragma omp target parallel for simd ordered() // expected-error {{expected expression}}
86 for (int i = 4; i < 12; i++)
87 argv[0][i] = argv[0][i] - argv[0][i - 4];
88 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
89 #pragma omp target parallel for simd ordered(4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
90 for (int i = 4; i < 12; i++)
91 argv[0][i] = argv[0][i] - argv[0][i - 4];
92 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
93 #pragma omp target parallel for simd ordered(2 + 2)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel for simd' are ignored}}
94 for (int i = 4; i < 12; i++)
95 argv[0][i] = argv[0][i] - argv[0][i - 4];
97 #pragma omp target parallel for simd ordered(foobool(1) > 0 ? 1 : 2) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
98 for (int i = 4; i < 12; i++)
99 argv[0][i] = argv[0][i] - argv[0][i - 4];
101 // expected-error@+3 {{integral constant expression}} expected-note@+3 0+{{constant expression}}
102 // expected-error@+2 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'ordered' clause}}
103 // expected-error@+1 {{argument to 'ordered' clause must be a strictly positive integer value}}
104 #pragma omp target parallel for simd ordered(foobool(argc)), ordered(true), ordered(-5)
105 for (int i = 4; i < 12; i++)
106 argv[0][i] = argv[0][i] - argv[0][i - 4];
107 #pragma omp target parallel for simd ordered(S1) // expected-error {{'S1' does not refer to a value}}
108 for (int i = 4; i < 12; i++)
109 argv[0][i] = argv[0][i] - argv[0][i - 4];
111 // expected-error@+1 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
112 #pragma omp target parallel for simd ordered(j = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
113 for (int i = 4; i < 12; i++)
114 argv[0][i] = argv[0][i] - argv[0][i - 4];
115 // expected-error@+2 {{statement after '#pragma omp target parallel for simd' must be a for loop}}
116 #pragma omp target parallel for simd ordered(ordered(tmain < int, char, -1, -2 > (argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
117 foo();
118 // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}}
119 #pragma omp target parallel for simd ordered(2)
120 foo();
121 return tmain<int, char, 1, 0>(argc, argv);