Alexey Bataev | db39021 | 2015-05-20 04:24:19 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 -o - %s |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2 | |
Alexey Bataev | a8a9153a | 2017-12-29 18:07:07 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s |
| 4 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 5 | void foo() { |
| 6 | } |
| 7 | |
| 8 | #pragma omp parallel sections // expected-error {{unexpected OpenMP directive '#pragma omp parallel sections'}} |
| 9 | |
| 10 | int main(int argc, char **argv) { |
| 11 | #pragma omp parallel sections {// expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 12 | { |
| 13 | foo(); |
| 14 | } |
| 15 | #pragma omp parallel sections( // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 16 | { |
| 17 | foo(); |
| 18 | } |
| 19 | #pragma omp parallel sections[ // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 20 | { |
| 21 | foo(); |
| 22 | } |
| 23 | #pragma omp parallel sections] // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 24 | { |
| 25 | foo(); |
| 26 | } |
| 27 | #pragma omp parallel sections) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 28 | { |
| 29 | foo(); |
| 30 | } |
| 31 | #pragma omp parallel sections } // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 32 | { |
| 33 | foo(); |
| 34 | } |
| 35 | // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} |
| 36 | #pragma omp parallel sections unknown() |
| 37 | { |
| 38 | foo(); |
| 39 | #pragma omp section |
| 40 | L1: |
| 41 | foo(); |
| 42 | } |
| 43 | #pragma omp parallel sections |
| 44 | { |
| 45 | ; |
| 46 | } |
| 47 | #pragma omp parallel sections |
| 48 | { |
| 49 | goto L1; // expected-error {{use of undeclared label 'L1'}} |
| 50 | } |
| 51 | |
| 52 | for (int i = 0; i < 10; ++i) { |
| 53 | switch (argc) { |
| 54 | case (0): |
| 55 | #pragma omp parallel sections |
| 56 | { |
| 57 | foo(); |
| 58 | break; // expected-error {{'break' statement not in loop or switch statement}} |
| 59 | continue; // expected-error {{'continue' statement not in loop statement}} |
| 60 | } |
| 61 | default: |
| 62 | break; |
| 63 | } |
| 64 | } |
| 65 | #pragma omp parallel sections default(none) |
| 66 | { |
| 67 | ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} |
| 68 | } |
| 69 | |
| 70 | goto L2; // expected-error {{use of undeclared label 'L2'}} |
| 71 | #pragma omp parallel sections |
| 72 | { |
| 73 | L2: |
| 74 | foo(); |
| 75 | } |
| 76 | #pragma omp parallel sections |
| 77 | { |
| 78 | return 1; // expected-error {{cannot return from OpenMP region}} |
| 79 | } |
| 80 | |
| 81 | [[]] // expected-error {{an attribute list cannot appear here}} |
| 82 | #pragma omp parallel sections |
| 83 | { |
| 84 | } |
| 85 | |
| 86 | return 0; |
| 87 | } |