Home | History | Annotate | Download | only in OpenMP
      1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %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   int n;
     15 #pragma omp target update to(n) if // expected-error {{expected '(' after 'if'}}
     16 #pragma omp target update from(n) if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     17 #pragma omp target update to(n) if () // expected-error {{expected expression}}
     18 #pragma omp target update from(n) if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     19 #pragma omp target update to(n) if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}}
     20 #pragma omp target update from(n) if (argc > 0 ? argv[1] : argv[2])
     21 #pragma omp target update to(n) if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target update' cannot contain more than one 'if' clause}}
     22 #pragma omp target update from(n) if (S) // expected-error {{'S' does not refer to a value}}
     23 #pragma omp target update to(n) if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     24 #pragma omp target update from(n) if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     25 #pragma omp target update to(n) if(argc)
     26 #pragma omp target update from(n) if(target update // expected-warning {{missing ':' after directive name modifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     27 #pragma omp target update to(n) if(target update : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     28 #pragma omp target update from(n) if(target update : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     29 #pragma omp target update to(n) if(target update : argc)
     30 #pragma omp target update from(n) if(target update : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target update'}}
     31 #pragma omp target update to(n) if(target update : argc) if (target update:argc) // expected-error {{directive '#pragma omp target update' cannot contain more than one 'if' clause with 'target update' name modifier}}
     32 #pragma omp target update from(n) if(target update : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
     33   return 0;
     34 }
     35 
     36 int main(int argc, char **argv) {
     37   int m;
     38 #pragma omp target update to(m) if // expected-error {{expected '(' after 'if'}}
     39 #pragma omp target update from(m) if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     40 #pragma omp target update to(m) if () // expected-error {{expected expression}}
     41 #pragma omp target update from(m) if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     42 #pragma omp target update to(m) if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}}
     43 #pragma omp target update from(m) if (argc > 0 ? argv[1] : argv[2])
     44 #pragma omp target update to(m) if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target update' cannot contain more than one 'if' clause}}
     45 #pragma omp target update from(m) if (S1) // expected-error {{'S1' does not refer to a value}}
     46 #pragma omp target update to(m) if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     47 #pragma omp target update from(m) if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     48 #pragma omp target update to(m) if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     49 #pragma omp target update from(m) if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     50 #pragma omp target update to(m) if(target update // expected-warning {{missing ':' after directive name modifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     51 #pragma omp target update from(m) if(target update : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     52 #pragma omp target update to(m) if(target update : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     53 #pragma omp target update from(m) if(target update : argc)
     54 #pragma omp target update to(m) if(target update : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target update'}}
     55 #pragma omp target update from(m) if(target update : argc) if (target update:argc)  // expected-error {{directive '#pragma omp target update' cannot contain more than one 'if' clause with 'target update' name modifier}}
     56 #pragma omp target update to(m) if(target update : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
     57   return tmain(argc, argv);
     58 }
     59