1 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 -o - %s 2 // RUN: not %clang_cc1 -fopenmp -std=c++11 -omptargets=aaa-bbb-ccc-ddd -o - %s 2>&1 | FileCheck %s 3 // CHECK: error: OpenMP target is invalid: 'aaa-bbb-ccc-ddd' 4 5 void foo() { 6 } 7 8 static int pvt; 9 #pragma omp threadprivate(pvt) 10 11 #pragma omp target parallel // expected-error {{unexpected OpenMP directive '#pragma omp target parallel'}} 12 13 int main(int argc, char **argv) { 14 #pragma omp target parallel { // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 15 foo(); 16 #pragma omp target parallel ( // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 17 foo(); 18 #pragma omp target parallel [ // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 19 foo(); 20 #pragma omp target parallel ] // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 21 foo(); 22 #pragma omp target parallel ) // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 23 foo(); 24 #pragma omp target parallel } // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 25 foo(); 26 #pragma omp target parallel 27 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 28 #pragma omp target parallel unknown() 29 foo(); 30 L1: 31 foo(); 32 #pragma omp target parallel 33 ; 34 #pragma omp target parallel 35 { 36 goto L1; // expected-error {{use of undeclared label 'L1'}} 37 argc++; 38 } 39 40 for (int i = 0; i < 10; ++i) { 41 switch(argc) { 42 case (0): 43 #pragma omp target parallel 44 { 45 foo(); 46 break; // expected-error {{'break' statement not in loop or switch statement}} 47 continue; // expected-error {{'continue' statement not in loop statement}} 48 } 49 default: 50 break; 51 } 52 } 53 54 goto L2; // expected-error {{use of undeclared label 'L2'}} 55 #pragma omp target parallel 56 L2: 57 foo(); 58 #pragma omp target parallel 59 { 60 return 1; // expected-error {{cannot return from OpenMP region}} 61 } 62 63 [[]] // expected-error {{an attribute list cannot appear here}} 64 #pragma omp target parallel 65 for (int n = 0; n < 100; ++n) {} 66 67 #pragma omp target parallel copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp target parallel'}} 68 foo(); 69 70 return 0; 71 } 72 73