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