[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / flush_messages.cpp
blobad4830b5bf94f961c4a94a3ff4275d4b6e3aaeb1
1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp -ferror-limit 100 %s -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
7 struct S1 { // expected-note 2 {{declared here}}
8 int a;
9 };
11 template <class T>
12 T tmain(T argc) {
13 #pragma omp flush allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp flush'}}
15 #pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}}
16 #pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
17 if (argc)
18 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
19 if (argc) {
20 #pragma omp flush
22 while (argc)
23 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
24 while (argc) {
25 #pragma omp flush
28 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
29 while (argc)
31 do {
32 #pragma omp flush
33 } while (argc);
34 switch (argc)
35 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
36 switch (argc)
37 case 1:
38 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
39 switch (argc)
40 case 1: {
41 #pragma omp flush
43 switch (argc) {
44 #pragma omp flush
45 case 1:
46 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
47 break;
48 default: {
49 #pragma omp flush
50 } break;
52 for (;;)
53 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
54 for (;;) {
55 #pragma omp flush
57 label:
58 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
59 label1 : {
60 #pragma omp flush
63 #pragma omp flush
64 #pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
65 #pragma omp flush() // expected-error {{expected expression}}
66 #pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
67 #pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
68 #pragma omp flush(argc)
69 #pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}}
70 #pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
71 #pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
73 return T();
76 int main(int argc, char **argv) {
77 #pragma omp flush
79 #pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}}
80 #pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
81 if (argc)
82 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
83 if (argc) {
84 #pragma omp flush
86 while (argc)
87 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
88 while (argc) {
89 #pragma omp flush
92 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
93 while (argc)
95 do {
96 #pragma omp flush
97 } while (argc);
98 switch (argc)
99 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
100 switch (argc)
101 case 1:
102 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
103 switch (argc)
104 case 1: {
105 #pragma omp flush
107 switch (argc) {
108 #pragma omp flush
109 case 1:
110 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
111 break;
112 default: {
113 #pragma omp flush
114 } break;
116 for (;;)
117 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
118 for (;;) {
119 #pragma omp flush
121 label:
122 #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
123 label1 : {
124 #pragma omp flush
127 #pragma omp flush
128 #pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
129 #pragma omp flush() // expected-error {{expected expression}}
130 #pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
131 #pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
132 #pragma omp flush(argc)
133 #pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}}
134 #pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
135 #pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
137 #pragma omp flush seq_cst // expected-error {{unexpected OpenMP clause 'seq_cst' in directive '#pragma omp flush'}}
138 #pragma omp flush acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}}
139 #pragma omp flush acquire // omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}}
140 #pragma omp flush release // omp45-error {{unexpected OpenMP clause 'release' in directive '#pragma omp flush'}}
141 #pragma omp flush relaxed // expected-error {{unexpected OpenMP clause 'relaxed' in directive '#pragma omp flush'}}
142 #pragma omp flush seq_cst // expected-error {{unexpected OpenMP clause 'seq_cst' in directive '#pragma omp flush'}}
143 #pragma omp flush acq_rel acquire // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}} omp51-error {{directive '#pragma omp flush' cannot contain more than one 'acq_rel', 'acquire' or 'release' clause}} omp51-note {{'acq_rel' clause used here}}
144 #pragma omp flush release acquire // omp45-error {{unexpected OpenMP clause 'release' in directive '#pragma omp flush'}} omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}} omp51-error {{directive '#pragma omp flush' cannot contain more than one 'acq_rel', 'acquire' or 'release' clause}} omp51-note {{'release' clause used here}}
145 #pragma omp flush acq_rel (argc) // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
146 #pragma omp flush(argc) acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} omp51-error {{'flush' directive with memory order clause 'acq_rel' cannot have the list}} omp51-note {{memory order clause 'acq_rel' is specified here}}
147 return tmain(argc);