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