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 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx64-nvidia-cuda -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s 5 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx-nvidia-cuda -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s 6 // CHECK-UNSUPPORTED-HOST-TARGET: error: The target '{{nvptx64-nvidia-cuda|nvptx-nvidia-cuda}}' is not a supported OpenMP host target. 7 8 void foo() { 9 } 10 11 #pragma omp target // expected-error {{unexpected OpenMP directive '#pragma omp target'}} 12 13 int main(int argc, char **argv) { 14 #pragma omp target { // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 15 foo(); 16 #pragma omp target ( // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 17 foo(); 18 #pragma omp target [ // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 19 foo(); 20 #pragma omp target ] // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 21 foo(); 22 #pragma omp target ) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 23 foo(); 24 #pragma omp target } // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} 25 foo(); 26 #pragma omp target 27 foo(); 28 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target' are ignored}} 29 #pragma omp target unknown() 30 foo(); 31 L1: 32 foo(); 33 #pragma omp target 34 ; 35 #pragma omp target 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 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 57 L2: 58 foo(); 59 #pragma omp target 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 66 for (int n = 0; n < 100; ++n) {} 67 68 return 0; 69 } 70 71