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