| 1 | // RUN: %clang_cc1 -verify -fopenmp -std=c++11 -o - %s |
| 2 | |
| 3 | // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s |
| 4 | |
| 5 | void foo() { |
| 6 | } |
| 7 | |
| 8 | #pragma omp teams // expected-error {{unexpected OpenMP directive '#pragma omp teams'}} |
| 9 | |
| 10 | int main(int argc, char **argv) { |
| 11 | #pragma omp target |
| 12 | #pragma omp teams |
| 13 | f; // expected-error {{use of undeclared identifier 'f'}} |
| 14 | #pragma omp target |
| 15 | #pragma omp teams { // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 16 | foo(); |
| 17 | #pragma omp target |
| 18 | #pragma omp teams ( // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 19 | foo(); |
| 20 | #pragma omp target |
| 21 | #pragma omp teams [ // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 22 | foo(); |
| 23 | #pragma omp target |
| 24 | #pragma omp teams ] // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 25 | foo(); |
| 26 | #pragma omp target |
| 27 | #pragma omp teams ) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 28 | foo(); |
| 29 | #pragma omp target |
| 30 | #pragma omp teams } // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 31 | foo(); |
| 32 | #pragma omp target |
| 33 | #pragma omp teams |
| 34 | foo(); |
| 35 | // expected-warning@+2 {{extra tokens at the end of '#pragma omp teams' are ignored}} |
| 36 | #pragma omp target |
| 37 | #pragma omp teams unknown() |
| 38 | foo(); |
| 39 | L1: |
| 40 | foo(); |
| 41 | #pragma omp target |
| 42 | #pragma omp teams |
| 43 | ; |
| 44 | #pragma omp target |
| 45 | #pragma omp teams |
| 46 | { |
| 47 | goto L1; // expected-error {{use of undeclared label 'L1'}} |
| 48 | argc++; |
| 49 | } |
| 50 | |
| 51 | for (int i = 0; i < 10; ++i) { |
| 52 | switch(argc) { |
| 53 | case (0): |
| 54 | #pragma omp target |
| 55 | #pragma omp teams |
| 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 target |
| 66 | #pragma omp teams default(none) |
| 67 | ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} |
| 68 | |
| 69 | goto L2; // expected-error {{use of undeclared label 'L2'}} |
| 70 | #pragma omp target |
| 71 | #pragma omp teams |
| 72 | L2: |
| 73 | foo(); |
| 74 | #pragma omp target |
| 75 | #pragma omp teams |
| 76 | { |
| 77 | return 1; // expected-error {{cannot return from OpenMP region}} |
| 78 | } |
| 79 | |
| 80 | [[]] // expected-error {{an attribute list cannot appear here}} |
| 81 | #pragma omp target |
| 82 | #pragma omp teams |
| 83 | for (int n = 0; n < 100; ++n) {} |
| 84 | |
| 85 | return 0; |
| 86 | } |
| 87 | |
| 88 | |