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