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 parallel if // expected-error {{expected '(' after 'if'}} 15 foo(); 16 #pragma omp target parallel if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 17 foo(); 18 #pragma omp target parallel if () // expected-error {{expected expression}} 19 foo(); 20 #pragma omp target parallel if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 21 foo(); 22 #pragma omp target parallel if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 23 foo(); 24 #pragma omp target parallel if (argc > 0 ? argv[1] : argv[2]) 25 foo(); 26 #pragma omp target parallel if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target parallel' cannot contain more than one 'if' clause}} 27 foo(); 28 #pragma omp target parallel if (S) // expected-error {{'S' does not refer to a value}} 29 foo(); 30 #pragma omp target parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 31 foo(); 32 #pragma omp target parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 33 foo(); 34 #pragma omp target parallel if(argc) 35 foo(); 36 #pragma omp target parallel if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 37 foo(); 38 #pragma omp target parallel if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 39 foo(); 40 #pragma omp target parallel if(target : argc) 41 foo(); 42 #pragma omp target parallel if(parallel : argc) 43 foo(); 44 #pragma omp target parallel if(target : argc) if(parallel : argc) 45 foo(); 46 #pragma omp target parallel if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target parallel'}} 47 foo(); 48 #pragma omp target parallel if(target : argc) if (target :argc) // expected-error {{directive '#pragma omp target parallel' cannot contain more than one 'if' clause with 'target' name modifier}} 49 foo(); 50 #pragma omp target parallel if(parallel : argc) if (parallel :argc) // expected-error {{directive '#pragma omp target parallel' cannot contain more than one 'if' clause with 'parallel' name modifier}} 51 foo(); 52 #pragma omp target parallel if(target : argc) if (argc) // expected-error {{expected 'parallel' directive name modifier}} expected-note {{previous clause with directive name modifier specified here}} 53 foo(); 54 #pragma omp target parallel if(target : argc) if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}} expected-note {{previous clause with directive name modifier specified here}} 55 foo(); 56 57 return 0; 58 } 59 60 int main(int argc, char **argv) { 61 #pragma omp target parallel if // expected-error {{expected '(' after 'if'}} 62 foo(); 63 #pragma omp target parallel if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 64 foo(); 65 #pragma omp target parallel if () // expected-error {{expected expression}} 66 foo(); 67 #pragma omp target parallel if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 68 foo(); 69 #pragma omp target parallel if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}} 70 foo(); 71 #pragma omp target parallel if (argc > 0 ? argv[1] : argv[2]) 72 foo(); 73 #pragma omp target parallel if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target parallel' cannot contain more than one 'if' clause}} 74 foo(); 75 #pragma omp target parallel if (S1) // expected-error {{'S1' does not refer to a value}} 76 foo(); 77 #pragma omp target parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 78 foo(); 79 #pragma omp target parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 80 foo(); 81 #pragma omp target parallel if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} 82 foo(); 83 #pragma omp target parallel if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 84 foo(); 85 #pragma omp target parallel if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 86 foo(); 87 #pragma omp target parallel if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 88 foo(); 89 #pragma omp target parallel if(parallel : argc) 90 foo(); 91 #pragma omp target parallel if(target : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target parallel'}} 92 foo(); 93 #pragma omp target parallel if(target : argc) if (target :argc) // expected-error {{directive '#pragma omp target parallel' cannot contain more than one 'if' clause with 'target' name modifier}} 94 foo(); 95 #pragma omp target parallel if(parallel : argc) if (parallel :argc) // expected-error {{directive '#pragma omp target parallel' cannot contain more than one 'if' clause with 'parallel' name modifier}} 96 foo(); 97 #pragma omp target parallel if(target : argc) if (argc) // expected-error {{expected 'parallel' directive name modifier}} expected-note {{previous clause with directive name modifier specified here}} 98 foo(); 99 #pragma omp target parallel if(target : argc) if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}} expected-note {{previous clause with directive name modifier specified here}} 100 foo(); 101 102 return tmain(argc, argv); 103 } 104