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