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 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target' are ignored}} 25 #pragma omp target unknown() 26 foo(); 27 L1: 28 foo(); 29 #pragma omp target 30 ; 31 #pragma omp target 32 { 33 goto L1; // expected-error {{use of undeclared label 'L1'}} 34 argc++; 35 } 36 37 for (int i = 0; i < 10; ++i) { 38 switch(argc) { 39 case (0): 40 #pragma omp target 41 { 42 foo(); 43 break; // expected-error {{'break' statement not in loop or switch statement}} 44 continue; // expected-error {{'continue' statement not in loop statement}} 45 } 46 default: 47 break; 48 } 49 } 50 51 goto L2; // expected-error {{use of undeclared label 'L2'}} 52 #pragma omp target 53 L2: 54 foo(); 55 #pragma omp target 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 62 for (int n = 0; n < 100; ++n) {} 63 64 return 0; 65 } 66 67