Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / depobj_messages.cpp
blob38617e16cab9c9aa17645cac9f7a78b3bc2b4093
1 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 \
2 // RUN: -ferror-limit 100 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp \
4 // RUN: -ferror-limit 100 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 \
6 // RUN: -ferror-limit 100 %s -Wuninitialized
8 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 \
9 // RUN: -ferror-limit 100 %s -Wuninitialized
10 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp-simd \
11 // RUN: -ferror-limit 100 %s -Wuninitialized
12 // RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 \
13 // RUN: -ferror-limit 100 %s -Wuninitialized
15 struct S1 { // expected-note 2 {{declared here}}
16 int a;
17 } s;
19 #pragma omp depobj(0) depend(in:s) // expected-error {{unexpected OpenMP directive '#pragma omp depobj'}}
20 void foo() {
21 #pragma omp depobj(0) depend(in:s) // expected-error {{'omp_depend_t' type not found; include <omp.h>}} expected-error {{expected lvalue expression}}}
24 typedef void *omp_depend_t;
26 template <class T>
27 T tmain(T argc) {
28 omp_depend_t x;
29 #pragma omp depobj() allocate(argc) // expected-error {{expected expression}} expected-error {{expected depobj expression}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp depobj'}}
31 #pragma omp depobj(x) untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp depobj'}}
32 #pragma omp depobj(x) unknown // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
33 if (argc)
34 #pragma omp depobj(x) destroy // omp52-error {{expected 'destroy' clause with an argument on '#pragma omp depobj' construct}} expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
35 if (argc) {
36 #pragma omp depobj(x) depend(in:s)
38 while (argc)
39 #pragma omp depobj(x)update(inout) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
40 while (argc) {
41 #pragma omp depobj(x) depend(in:s)
44 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
45 while (argc)
47 do {
48 #pragma omp depobj(x) depend(in:s)
49 } while (argc);
50 switch (argc)
51 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
52 switch (argc)
53 case 1:
54 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
55 switch (argc)
56 case 1: {
57 #pragma omp depobj(x) depend(in:s)
59 switch (argc) {
60 #pragma omp depobj(x) depend(in:s)
61 case 1:
62 #pragma omp depobj(x) depend(in:s)
63 break;
64 default: {
65 #pragma omp depobj(x) depend(in:s)
66 } break;
68 for (;;)
69 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
70 for (;;) {
71 #pragma omp depobj(x) depend(in:s)
73 label:
74 #pragma omp depobj(x) depend(in:s)
75 label1 : {
76 #pragma omp depobj(x) depend(in:s)
79 #pragma omp depobj // expected-error {{expected depobj expression}}
80 #pragma omp depobj( // expected-error {{expected expression}} expected-error {{expected depobj expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
81 #pragma omp depobj() // expected-error {{expected expression}} expected-error {{expected depobj expression}}
82 #pragma omp depobj(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}}
83 #pragma omp depobj(argc, // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
84 #pragma omp depobj(argc) // expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
85 #pragma omp depobj(S1) // expected-error {{'S1' does not refer to a value}} expected-error {{expected depobj expression}}
86 #pragma omp depobj(argc) depobj(argc) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}}
87 #pragma omp parallel depobj(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
89 return T();
92 int main(int argc, char **argv) {
93 omp_depend_t x;
94 #pragma omp depobj(x) depend(in:s)
96 #pragma omp depobj(x) untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp depobj'}}
97 #pragma omp depobj(x) unknown // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
98 if (argc)
99 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
100 if (argc) {
101 #pragma omp depobj(x) depend(in:s)
103 while (argc)
104 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
105 while (argc) {
106 #pragma omp depobj(x) depend(in:s)
109 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
110 while (argc)
112 do {
113 #pragma omp depobj(x) depend(in:s)
114 } while (argc);
115 switch (argc)
116 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
117 switch (argc)
118 case 1:
119 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
120 switch (argc)
121 case 1: {
122 #pragma omp depobj(x) depend(in:s)
124 switch (argc) {
125 #pragma omp depobj(x) depend(in:s)
126 case 1:
127 #pragma omp depobj(x) depend(in:s)
128 break;
129 default: {
130 #pragma omp depobj(x) depend(in:s)
131 } break;
133 for (;;)
134 #pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
135 for (;;) {
136 #pragma omp depobj(x) depend(in:s)
138 label:
139 #pragma omp depobj(x) depend(in:s)
140 label1 : {
141 #pragma omp depobj(x) depend(in:s)
144 #pragma omp depobj // expected-error {{expected depobj expression}}
145 #pragma omp depobj( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected depobj expression}}
146 #pragma omp depobj() // expected-error {{expected expression}} expected-error {{expected depobj expression}}
147 #pragma omp depobj(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
148 #pragma omp depobj(argc, // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
149 #pragma omp depobj(argc) // expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
150 #pragma omp depobj(S1) // expected-error {{'S1' does not refer to a value}} expected-error {{expected depobj expression}}
151 #pragma omp depobj(argc) depobj(argc) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}} expected-error {{expected lvalue expression of 'omp_depend_t' type, not 'int'}}
152 #pragma omp parallel depobj(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
154 #pragma omp depobj(x) seq_cst // expected-error {{unexpected OpenMP clause 'seq_cst' in directive '#pragma omp depobj'}}
155 #pragma omp depobj(x) depend(source: x) // omp52-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'inoutset' in OpenMP clause 'depend'}} omp51-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'inoutset' in OpenMP clause 'depend'}} omp50-error {{expected depend modifier(iterator) or 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}}
156 #pragma omp depobj(x) update // expected-error {{expected '(' after 'update'}}
157 #pragma omp depobj(x) update( // expected-error {{expected ')'}} expected-note {{to match this '('}} omp52-error {{expected 'in', 'out', 'inout', 'mutexinoutset' or 'inoutset' in OpenMP clause 'update'}} omp51-error {{expected 'in', 'out', 'inout', 'mutexinoutset' or 'inoutset' in OpenMP clause 'update'}} omp50-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'update'}}
158 #pragma omp depobj(x) update(sink // expected-error {{expected ')'}} expected-note {{to match this '('}} omp52-error {{expected 'in', 'out', 'inout', 'mutexinoutset' or 'inoutset' in OpenMP clause 'update'}} omp51-error {{expected 'in', 'out', 'inout', 'mutexinoutset' or 'inoutset' in OpenMP clause 'update'}} omp50-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'update'}}
159 #pragma omp depobj(x) destroy destroy //omp52-error {{expected 'destroy' clause with an argument on '#pragma omp depobj' construct}} omp50-error {{directive '#pragma omp depobj' cannot contain more than one 'destroy' clause}} // omp52-error {{directive '#pragma omp depobj' cannot contain more than one 'destroy' clause}} omp52-error {{expected 'destroy' clause with an argument on '#pragma omp depobj' construct}} omp51-error {{directive '#pragma omp depobj' cannot contain more than one 'destroy' clause}}
160 #pragma omp depobj(x) update(in) update(in) // expected-error {{directive '#pragma omp depobj' cannot contain more than one 'update' clause}}
161 #pragma omp depobj(x) depend(in: argc) destroy // omp52-error {{expected 'destroy' clause with an argument on '#pragma omp depobj' construct}} omp51-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}} omp50-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
162 #pragma omp depobj(x) destroy depend(in: argc) // omp52-error {{expected 'destroy' clause with an argument on '#pragma omp depobj' construct}} omp51-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}} omp50-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
163 #pragma omp depobj(x) depend(in: argc) update(mutexinoutset) // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
164 #pragma omp depobj(x) update(inout) destroy // omp52-error {{expected 'destroy' clause with an argument on '#pragma omp depobj' construct}} omp51-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}} omp50-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
165 #pragma omp depobj(x) (x) depend(in: x) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
166 #pragma omp depobj(x) (x) update(in) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
167 #pragma omp depobj(x) depend(in: argc) depend(out:argc) // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
168 #pragma omp depend(out:x) depobj(x) // expected-error {{expected an OpenMP directive}}
169 #pragma omp destroy depobj(x) // expected-error {{expected an OpenMP directive}}
170 #pragma omp update(out) depobj(x) // expected-error {{expected an OpenMP directive}}
171 #pragma omp depobj depend(in:x) (x) // expected-error {{expected depobj expression}} expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}} expected-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}}
172 #pragma omp depobj destroy (x) // omp52-error {{expected 'destroy' clause with an argument on '#pragma omp depobj' construct}} expected-error {{expected depobj expression}} expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
173 #pragma omp depobj update(in) (x) // expected-error {{expected depobj expression}} expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
174 return tmain(argc); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}}