Home | History | Annotate | Download | only in OpenMP
      1 // RUN: %clang_cc1 -verify -fopenmp %s
      2 
      3 void foo() {
      4 }
      5 
      6 bool foobool(int argc) {
      7   return argc;
      8 }
      9 
     10 struct S1; // expected-note {{declared here}}
     11 
     12 template <class T, class S> // expected-note {{declared here}}
     13 int tmain(T argc, S **argv) {
     14   #pragma omp target if // expected-error {{expected '(' after 'if'}}
     15   foo();
     16   #pragma omp target if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     17   foo();
     18   #pragma omp target if () // expected-error {{expected expression}}
     19   foo();
     20   #pragma omp target if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     21   foo();
     22   #pragma omp target if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
     23   foo();
     24   #pragma omp target if (argc > 0 ? argv[1] : argv[2])
     25   foo();
     26   #pragma omp target if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target' cannot contain more than one 'if' clause}}
     27   foo();
     28   #pragma omp target if (S) // expected-error {{'S' does not refer to a value}}
     29   foo();
     30   #pragma omp target if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     31   foo();
     32   #pragma omp target if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     33   foo();
     34   #pragma omp target if(argc)
     35   foo();
     36   #pragma omp target if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     37   foo();
     38   #pragma omp target if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     39   foo();
     40   #pragma omp target if(target : argc)
     41   foo();
     42   #pragma omp target if(target : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target'}}
     43   foo();
     44   #pragma omp target if(target : argc) if (target:argc) // expected-error {{directive '#pragma omp target' cannot contain more than one 'if' clause with 'target' name modifier}}
     45   foo();
     46   #pragma omp target if(target : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
     47   foo();
     48 
     49   return 0;
     50 }
     51 
     52 int main(int argc, char **argv) {
     53   #pragma omp target if // expected-error {{expected '(' after 'if'}}
     54   foo();
     55   #pragma omp target if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     56   foo();
     57   #pragma omp target if () // expected-error {{expected expression}}
     58   foo();
     59   #pragma omp target if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     60   foo();
     61   #pragma omp target if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
     62   foo();
     63   #pragma omp target if (argc > 0 ? argv[1] : argv[2])
     64   foo();
     65   #pragma omp target if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target' cannot contain more than one 'if' clause}}
     66   foo();
     67   #pragma omp target if (S1) // expected-error {{'S1' does not refer to a value}}
     68   foo();
     69   #pragma omp target if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     70   foo();
     71   #pragma omp target if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     72   foo();
     73   #pragma omp target if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     74   foo();
     75   #pragma omp target if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     76   foo();
     77   #pragma omp target if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     78   foo();
     79   #pragma omp target if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     80   foo();
     81   #pragma omp target if(target : argc)
     82   foo();
     83   #pragma omp target if(target : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target'}}
     84   foo();
     85   #pragma omp target if(target : argc) if (target:argc) // expected-error {{directive '#pragma omp target' cannot contain more than one 'if' clause with 'target' name modifier}}
     86   foo();
     87   #pragma omp target if(target : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
     88   foo();
     89 
     90   return tmain(argc, argv);
     91 }
     92