| 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 |
| 3 |
|
| 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 |
| 6 |
|
| 7 |
struct S1 { // expected-note 2 {{declared here}} |
| 8 |
int a; |
| 9 |
}; |
| 10 |
|
| 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'}} |
| 14 |
; |
| 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 |
| 21 |
} |
| 22 |
while (argc) |
| 23 |
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 24 |
while (argc) { |
| 25 |
#pragma omp flush |
| 26 |
} |
| 27 |
do |
| 28 |
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 29 |
while (argc) |
| 30 |
; |
| 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 |
| 42 |
} |
| 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; |
| 51 |
} |
| 52 |
for (;;) |
| 53 |
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 54 |
for (;;) { |
| 55 |
#pragma omp flush |
| 56 |
} |
| 57 |
label: |
| 58 |
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 59 |
label1 : { |
| 60 |
#pragma omp flush |
| 61 |
} |
| 62 |
|
| 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}} |
| 72 |
; |
| 73 |
return T(); |
| 74 |
} |
| 75 |
|
| 76 |
int main(int argc, char **argv) { |
| 77 |
#pragma omp flush |
| 78 |
; |
| 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 |
| 85 |
} |
| 86 |
while (argc) |
| 87 |
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 88 |
while (argc) { |
| 89 |
#pragma omp flush |
| 90 |
} |
| 91 |
do |
| 92 |
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 93 |
while (argc) |
| 94 |
; |
| 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 |
| 106 |
} |
| 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; |
| 115 |
} |
| 116 |
for (;;) |
| 117 |
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 118 |
for (;;) { |
| 119 |
#pragma omp flush |
| 120 |
} |
| 121 |
label: |
| 122 |
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 123 |
label1 : { |
| 124 |
#pragma omp flush |
| 125 |
} |
| 126 |
|
| 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}} |
| 136 |
; |
| 137 |
#pragma omp flush acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} |
| 138 |
#pragma omp flush acquire // omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}} |
| 139 |
#pragma omp flush release // omp45-error {{unexpected OpenMP clause 'release' in directive '#pragma omp flush'}} |
| 140 |
#pragma omp flush relaxed // expected-error {{unexpected OpenMP clause 'relaxed' in directive '#pragma omp flush'}} |
| 141 |
#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 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp51-note {{'acq_rel' clause used here}} |
| 142 |
#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 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp51-note {{'release' clause used here}} |
| 143 |
#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}} |
| 144 |
#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}} |
| 145 |
return tmain(argc); |
| 146 |
} |