Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s |
| 2 | |
| 3 | void foo() { |
| 4 | } |
| 5 | |
| 6 | #pragma omp parallel // expected-error {{unexpected OpenMP directive '#pragma omp parallel'}} |
| 7 | |
| 8 | int main(int argc, char **argv) { |
| 9 | #pragma omp parallel |
| 10 | #pragma omp parallel unknown() // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} |
| 11 | foo(); |
| 12 | L1: |
| 13 | foo(); |
| 14 | #pragma omp parallel |
| 15 | ; |
| 16 | #pragma omp parallel |
| 17 | { |
| 18 | goto L1; // expected-error {{use of undeclared label 'L1'}} |
| 19 | argc++; |
| 20 | } |
| 21 | |
| 22 | for (int i = 0; i < 10; ++i) { |
| 23 | switch(argc) { |
| 24 | case (0): |
| 25 | #pragma omp parallel |
| 26 | { |
| 27 | foo(); |
| 28 | break; // expected-error {{'break' statement not in loop or switch statement}} |
| 29 | continue; // expected-error {{'continue' statement not in loop statement}} |
| 30 | } |
| 31 | default: |
| 32 | break; |
| 33 | } |
| 34 | } |
| 35 | #pragma omp parallel default(none) |
| 36 | ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} |
| 37 | |
| 38 | goto L2; // expected-error {{use of undeclared label 'L2'}} |
| 39 | #pragma omp parallel |
| 40 | L2: |
| 41 | foo(); |
| 42 | #pragma omp parallel |
| 43 | { |
| 44 | return 1; // expected-error {{cannot return from OpenMP region}} |
| 45 | } |
| 46 | |
| 47 | return 0; |
| 48 | } |
| 49 | |