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 #pragma omp target // expected-error {{unexpected OpenMP directive '#pragma omp target'}} 9 10 int main(int argc, char **argv) { 11 #pragma omp target { // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 12 foo(); 13 #pragma omp target ( // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 14 foo(); 15 #pragma omp target [ // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 16 foo(); 17 #pragma omp target ] // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 18 foo(); 19 #pragma omp target ) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 20 foo(); 21 #pragma omp target } // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 22 foo(); 23 #pragma omp target 24 foo(); 25 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target' are ignored}} 26 #pragma omp target unknown() 27 foo(); 28 L1: 29 foo(); 30 #pragma omp target 31 ; 32 #pragma omp target 33 { 34 goto L1; // expected-error {{use of undeclared label 'L1'}} 35 argc++; 36 } 37 38 for (int i = 0; i < 10; ++i) { 39 switch(argc) { 40 case (0): 41 #pragma omp target 42 { 43 foo(); 44 break; // expected-error {{'break' statement not in loop or switch statement}} 45 continue; // expected-error {{'continue' statement not in loop statement}} 46 } 47 default: 48 break; 49 } 50 } 51 52 goto L2; // expected-error {{use of undeclared label 'L2'}} 53 #pragma omp target 54 L2: 55 foo(); 56 #pragma omp target 57 { 58 return 1; // expected-error {{cannot return from OpenMP region}} 59 } 60 61 [[]] // expected-error {{an attribute list cannot appear here}} 62 #pragma omp target 63 for (int n = 0; n < 100; ++n) {} 64 65 return 0; 66 } 67 68