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