| 1 | // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s |
| 2 | |
| 3 | // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s |
| 4 | |
| 5 | struct S1 { // expected-note 2 {{declared here}} |
| 6 | int a; |
| 7 | }; |
| 8 | |
| 9 | template <class T> |
| 10 | T tmain(T argc) { |
| 11 | #pragma omp flush allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp flush'}} |
| 12 | ; |
| 13 | #pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}} |
| 14 | #pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} |
| 15 | if (argc) |
| 16 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 17 | if (argc) { |
| 18 | #pragma omp flush |
| 19 | } |
| 20 | while (argc) |
| 21 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 22 | while (argc) { |
| 23 | #pragma omp flush |
| 24 | } |
| 25 | do |
| 26 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 27 | while (argc) |
| 28 | ; |
| 29 | do { |
| 30 | #pragma omp flush |
| 31 | } while (argc); |
| 32 | switch (argc) |
| 33 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 34 | switch (argc) |
| 35 | case 1: |
| 36 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 37 | switch (argc) |
| 38 | case 1: { |
| 39 | #pragma omp flush |
| 40 | } |
| 41 | switch (argc) { |
| 42 | #pragma omp flush |
| 43 | case 1: |
| 44 | #pragma omp flush |
| 45 | break; |
| 46 | default: { |
| 47 | #pragma omp flush |
| 48 | } break; |
| 49 | } |
| 50 | for (;;) |
| 51 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 52 | for (;;) { |
| 53 | #pragma omp flush |
| 54 | } |
| 55 | label: |
| 56 | #pragma omp flush |
| 57 | label1 : { |
| 58 | #pragma omp flush |
| 59 | } |
| 60 | |
| 61 | #pragma omp flush |
| 62 | #pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 63 | #pragma omp flush() // expected-error {{expected expression}} |
| 64 | #pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 65 | #pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 66 | #pragma omp flush(argc) |
| 67 | #pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}} |
| 68 | #pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} |
| 69 | #pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} |
| 70 | ; |
| 71 | return T(); |
| 72 | } |
| 73 | |
| 74 | int main(int argc, char **argv) { |
| 75 | #pragma omp flush |
| 76 | ; |
| 77 | #pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}} |
| 78 | #pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} |
| 79 | if (argc) |
| 80 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 81 | if (argc) { |
| 82 | #pragma omp flush |
| 83 | } |
| 84 | while (argc) |
| 85 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 86 | while (argc) { |
| 87 | #pragma omp flush |
| 88 | } |
| 89 | do |
| 90 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 91 | while (argc) |
| 92 | ; |
| 93 | do { |
| 94 | #pragma omp flush |
| 95 | } while (argc); |
| 96 | switch (argc) |
| 97 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 98 | switch (argc) |
| 99 | case 1: |
| 100 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 101 | switch (argc) |
| 102 | case 1: { |
| 103 | #pragma omp flush |
| 104 | } |
| 105 | switch (argc) { |
| 106 | #pragma omp flush |
| 107 | case 1: |
| 108 | #pragma omp flush |
| 109 | break; |
| 110 | default: { |
| 111 | #pragma omp flush |
| 112 | } break; |
| 113 | } |
| 114 | for (;;) |
| 115 | #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} |
| 116 | for (;;) { |
| 117 | #pragma omp flush |
| 118 | } |
| 119 | label: |
| 120 | #pragma omp flush |
| 121 | label1 : { |
| 122 | #pragma omp flush |
| 123 | } |
| 124 | |
| 125 | #pragma omp flush |
| 126 | #pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 127 | #pragma omp flush() // expected-error {{expected expression}} |
| 128 | #pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 129 | #pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 130 | #pragma omp flush(argc) |
| 131 | #pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}} |
| 132 | #pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} |
| 133 | #pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} |
| 134 | ; |
| 135 | return tmain(argc); |
| 136 | } |
| 137 | |