Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp -std=c++11 -o - %s |
| 2 | |
| 3 | void foo() { |
| 4 | } |
| 5 | |
| 6 | #pragma omp target teams // expected-error {{unexpected OpenMP directive '#pragma omp target teams'}} |
| 7 | |
| 8 | int main(int argc, char **argv) { |
| 9 | #pragma omp target teams { // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}} |
| 10 | foo(); |
| 11 | #pragma omp target teams ( // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}} |
| 12 | foo(); |
| 13 | #pragma omp target teams [ // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}} |
| 14 | foo(); |
| 15 | #pragma omp target teams ] // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}} |
| 16 | foo(); |
| 17 | #pragma omp target teams ) // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}} |
| 18 | foo(); |
| 19 | #pragma omp target teams } // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}} |
| 20 | foo(); |
| 21 | #pragma omp target teams |
| 22 | foo(); |
| 23 | #pragma omp target teams unknown() // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}} |
| 24 | foo(); |
| 25 | L1: |
| 26 | foo(); |
| 27 | #pragma omp target teams |
| 28 | ; |
| 29 | #pragma omp target teams |
| 30 | { |
| 31 | goto L1; // expected-error {{use of undeclared label 'L1'}} |
| 32 | argc++; |
| 33 | } |
| 34 | |
| 35 | for (int i = 0; i < 10; ++i) { |
| 36 | switch(argc) { |
| 37 | case (0): |
| 38 | #pragma omp target teams |
| 39 | { |
| 40 | foo(); |
| 41 | break; // expected-error {{'break' statement not in loop or switch statement}} |
| 42 | continue; // expected-error {{'continue' statement not in loop statement}} |
| 43 | } |
| 44 | default: |
| 45 | break; |
| 46 | } |
| 47 | } |
| 48 | #pragma omp target teams default(none) |
| 49 | ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} |
| 50 | |
| 51 | goto L2; // expected-error {{use of undeclared label 'L2'}} |
| 52 | #pragma omp target teams |
| 53 | L2: |
| 54 | foo(); |
| 55 | #pragma omp target teams |
| 56 | { |
| 57 | return 1; // expected-error {{cannot return from OpenMP region}} |
| 58 | } |
| 59 | |
| 60 | [[]] // expected-error {{an attribute list cannot appear here}} |
| 61 | #pragma omp target teams |
| 62 | for (int n = 0; n < 100; ++n) {} |
| 63 | |
| 64 | return 0; |
| 65 | } |