1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc struct S1 { // expected-note 2 {{declared here}} 4*0a6a1f1dSLionel Sambuc int a; 5*0a6a1f1dSLionel Sambuc }; 6*0a6a1f1dSLionel Sambuc 7*0a6a1f1dSLionel Sambuc template <class T> tmain(T argc)8*0a6a1f1dSLionel SambucT tmain(T argc) { 9*0a6a1f1dSLionel Sambuc #pragma omp flush 10*0a6a1f1dSLionel Sambuc ; 11*0a6a1f1dSLionel Sambuc #pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}} 12*0a6a1f1dSLionel Sambuc #pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} 13*0a6a1f1dSLionel Sambuc if (argc) 14*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 15*0a6a1f1dSLionel Sambuc if (argc) { 16*0a6a1f1dSLionel Sambuc #pragma omp flush 17*0a6a1f1dSLionel Sambuc } 18*0a6a1f1dSLionel Sambuc while (argc) 19*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 20*0a6a1f1dSLionel Sambuc while (argc) { 21*0a6a1f1dSLionel Sambuc #pragma omp flush 22*0a6a1f1dSLionel Sambuc } 23*0a6a1f1dSLionel Sambuc do 24*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 25*0a6a1f1dSLionel Sambuc while (argc) 26*0a6a1f1dSLionel Sambuc ; 27*0a6a1f1dSLionel Sambuc do { 28*0a6a1f1dSLionel Sambuc #pragma omp flush 29*0a6a1f1dSLionel Sambuc } while (argc); 30*0a6a1f1dSLionel Sambuc switch (argc) 31*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 32*0a6a1f1dSLionel Sambuc switch (argc) 33*0a6a1f1dSLionel Sambuc case 1: 34*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 35*0a6a1f1dSLionel Sambuc switch (argc) 36*0a6a1f1dSLionel Sambuc case 1: { 37*0a6a1f1dSLionel Sambuc #pragma omp flush 38*0a6a1f1dSLionel Sambuc } 39*0a6a1f1dSLionel Sambuc switch (argc) { 40*0a6a1f1dSLionel Sambuc #pragma omp flush 41*0a6a1f1dSLionel Sambuc case 1: 42*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 43*0a6a1f1dSLionel Sambuc break; 44*0a6a1f1dSLionel Sambuc default: { 45*0a6a1f1dSLionel Sambuc #pragma omp flush 46*0a6a1f1dSLionel Sambuc } break; 47*0a6a1f1dSLionel Sambuc } 48*0a6a1f1dSLionel Sambuc for (;;) 49*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 50*0a6a1f1dSLionel Sambuc for (;;) { 51*0a6a1f1dSLionel Sambuc #pragma omp flush 52*0a6a1f1dSLionel Sambuc } 53*0a6a1f1dSLionel Sambuc label: 54*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 55*0a6a1f1dSLionel Sambuc label1 : { 56*0a6a1f1dSLionel Sambuc #pragma omp flush 57*0a6a1f1dSLionel Sambuc } 58*0a6a1f1dSLionel Sambuc 59*0a6a1f1dSLionel Sambuc #pragma omp flush 60*0a6a1f1dSLionel Sambuc #pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 61*0a6a1f1dSLionel Sambuc #pragma omp flush() // expected-error {{expected expression}} 62*0a6a1f1dSLionel Sambuc #pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 63*0a6a1f1dSLionel Sambuc #pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 64*0a6a1f1dSLionel Sambuc #pragma omp flush(argc) 65*0a6a1f1dSLionel Sambuc #pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}} 66*0a6a1f1dSLionel Sambuc #pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} 67*0a6a1f1dSLionel Sambuc #pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 68*0a6a1f1dSLionel Sambuc ; 69*0a6a1f1dSLionel Sambuc return T(); 70*0a6a1f1dSLionel Sambuc } 71*0a6a1f1dSLionel Sambuc main(int argc,char ** argv)72*0a6a1f1dSLionel Sambucint main(int argc, char **argv) { 73*0a6a1f1dSLionel Sambuc #pragma omp flush 74*0a6a1f1dSLionel Sambuc ; 75*0a6a1f1dSLionel Sambuc #pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}} 76*0a6a1f1dSLionel Sambuc #pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} 77*0a6a1f1dSLionel Sambuc if (argc) 78*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 79*0a6a1f1dSLionel Sambuc if (argc) { 80*0a6a1f1dSLionel Sambuc #pragma omp flush 81*0a6a1f1dSLionel Sambuc } 82*0a6a1f1dSLionel Sambuc while (argc) 83*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 84*0a6a1f1dSLionel Sambuc while (argc) { 85*0a6a1f1dSLionel Sambuc #pragma omp flush 86*0a6a1f1dSLionel Sambuc } 87*0a6a1f1dSLionel Sambuc do 88*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 89*0a6a1f1dSLionel Sambuc while (argc) 90*0a6a1f1dSLionel Sambuc ; 91*0a6a1f1dSLionel Sambuc do { 92*0a6a1f1dSLionel Sambuc #pragma omp flush 93*0a6a1f1dSLionel Sambuc } while (argc); 94*0a6a1f1dSLionel Sambuc switch (argc) 95*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 96*0a6a1f1dSLionel Sambuc switch (argc) 97*0a6a1f1dSLionel Sambuc case 1: 98*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 99*0a6a1f1dSLionel Sambuc switch (argc) 100*0a6a1f1dSLionel Sambuc case 1: { 101*0a6a1f1dSLionel Sambuc #pragma omp flush 102*0a6a1f1dSLionel Sambuc } 103*0a6a1f1dSLionel Sambuc switch (argc) { 104*0a6a1f1dSLionel Sambuc #pragma omp flush 105*0a6a1f1dSLionel Sambuc case 1: 106*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 107*0a6a1f1dSLionel Sambuc break; 108*0a6a1f1dSLionel Sambuc default: { 109*0a6a1f1dSLionel Sambuc #pragma omp flush 110*0a6a1f1dSLionel Sambuc } break; 111*0a6a1f1dSLionel Sambuc } 112*0a6a1f1dSLionel Sambuc for (;;) 113*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 114*0a6a1f1dSLionel Sambuc for (;;) { 115*0a6a1f1dSLionel Sambuc #pragma omp flush 116*0a6a1f1dSLionel Sambuc } 117*0a6a1f1dSLionel Sambuc label: 118*0a6a1f1dSLionel Sambuc #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} 119*0a6a1f1dSLionel Sambuc label1 : { 120*0a6a1f1dSLionel Sambuc #pragma omp flush 121*0a6a1f1dSLionel Sambuc } 122*0a6a1f1dSLionel Sambuc 123*0a6a1f1dSLionel Sambuc #pragma omp flush 124*0a6a1f1dSLionel Sambuc #pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 125*0a6a1f1dSLionel Sambuc #pragma omp flush() // expected-error {{expected expression}} 126*0a6a1f1dSLionel Sambuc #pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 127*0a6a1f1dSLionel Sambuc #pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 128*0a6a1f1dSLionel Sambuc #pragma omp flush(argc) 129*0a6a1f1dSLionel Sambuc #pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}} 130*0a6a1f1dSLionel Sambuc #pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} 131*0a6a1f1dSLionel Sambuc #pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 132*0a6a1f1dSLionel Sambuc ; 133*0a6a1f1dSLionel Sambuc return tmain(argc); 134*0a6a1f1dSLionel Sambuc } 135