1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -Wuninitialized 2 3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %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 teams 15 #pragma omp distribute simd if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}} 16 for (int i = 0; i < 10; ++i) 17 ; 18 } 19 20 struct S1; // expected-note {{declared here}} 21 22 template <class T, class S> // expected-note {{declared here}} 23 int tmain(T argc, S **argv) { 24 T z; 25 int i; 26 #pragma omp teams 27 #pragma omp distribute simd if // expected-error {{expected '(' after 'if'}} 28 for (i = 0; i < argc; ++i) foo(); 29 #pragma omp teams 30 #pragma omp distribute simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 31 for (i = 0; i < argc; ++i) foo(); 32 #pragma omp teams 33 #pragma omp distribute simd if () // expected-error {{expected expression}} 34 for (i = 0; i < argc; ++i) foo(); 35 #pragma omp teams 36 #pragma omp distribute simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 37 for (i = 0; i < argc; ++i) foo(); 38 #pragma omp teams 39 #pragma omp distribute simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} 40 for (i = 0; i < argc; ++i) foo(); 41 #pragma omp teams 42 #pragma omp distribute simd if (argc > 0 ? argv[1] : argv[2]) 43 for (i = 0; i < argc; ++i) foo(); 44 #pragma omp teams 45 #pragma omp distribute simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'if' clause}} 46 for (i = 0; i < argc; ++i) foo(); 47 #pragma omp teams 48 #pragma omp distribute simd if (S) // expected-error {{'S' does not refer to a value}} 49 for (i = 0; i < argc; ++i) foo(); 50 #pragma omp teams 51 #pragma omp distribute simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 52 for (i = 0; i < argc; ++i) foo(); 53 #pragma omp teams 54 #pragma omp distribute simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 55 for (i = 0; i < argc; ++i) foo(); 56 #pragma omp teams 57 #pragma omp distribute simd if(argc + z) 58 for (i = 0; i < argc; ++i) foo(); 59 #pragma omp teams 60 #pragma omp distribute simd if(simd : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 61 for (i = 0; i < argc; ++i) foo(); 62 #pragma omp teams 63 #pragma omp distribute simd if(simd : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 64 for (i = 0; i < argc; ++i) foo(); 65 #pragma omp teams 66 #pragma omp distribute simd if(simd : argc) 67 for (i = 0; i < argc; ++i) foo(); 68 #pragma omp teams 69 #pragma omp distribute simd if(target : argc) // expected-error {{directive name modifier 'target' is not allowed for '#pragma omp distribute simd'}} 70 for (i = 0; i < argc; ++i) foo(); 71 #pragma omp teams 72 #pragma omp distribute simd if(simd : argc) if (simd :argc) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'if' clause with 'simd' name modifier}} 73 for (i = 0; i < argc; ++i) foo(); 74 #pragma omp teams 75 #pragma omp distribute simd if(simd : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{no more 'if' clause is allowed}} 76 for (i = 0; i < argc; ++i) foo(); 77 78 return 0; 79 } 80 81 int main(int argc, char **argv) { 82 int i, z; 83 #pragma omp teams 84 #pragma omp distribute simd if // expected-error {{expected '(' after 'if'}} 85 for (i = 0; i < argc; ++i) foo(); 86 #pragma omp teams 87 #pragma omp distribute simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 88 for (i = 0; i < argc; ++i) foo(); 89 #pragma omp teams 90 #pragma omp distribute simd if () // expected-error {{expected expression}} 91 for (i = 0; i < argc; ++i) foo(); 92 #pragma omp teams 93 #pragma omp distribute simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 94 for (i = 0; i < argc; ++i) foo(); 95 #pragma omp teams 96 #pragma omp distribute simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} 97 for (i = 0; i < argc; ++i) foo(); 98 #pragma omp teams 99 #pragma omp distribute simd if (argc > 0 ? argv[1] : argv[2]) 100 for (i = 0; i < argc; ++i) foo(); 101 #pragma omp teams 102 #pragma omp distribute simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'if' clause}} 103 for (i = 0; i < argc; ++i) foo(); 104 #pragma omp teams 105 #pragma omp distribute simd if (S1) // expected-error {{'S1' does not refer to a value}} 106 for (i = 0; i < argc; ++i) foo(); 107 #pragma omp teams 108 #pragma omp distribute simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 109 for (i = 0; i < argc; ++i) foo(); 110 #pragma omp teams 111 #pragma omp distribute simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 112 for (i = 0; i < argc; ++i) foo(); 113 #pragma omp teams 114 #pragma omp distribute simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} 115 for (i = 0; i < argc; ++i) foo(); 116 #pragma omp teams 117 #pragma omp distribute simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 118 for (i = 0; i < argc; ++i) foo(); 119 #pragma omp teams 120 #pragma omp distribute simd if(simd : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 121 for (i = 0; i < argc; ++i) foo(); 122 #pragma omp teams 123 #pragma omp distribute simd if(simd : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 124 for (i = 0; i < argc; ++i) foo(); 125 #pragma omp teams 126 #pragma omp distribute simd if(simd : argc + z) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp distribute simd'}} 127 for (i = 0; i < argc; ++i) foo(); 128 #pragma omp teams 129 #pragma omp distribute simd if(simd : argc) if (simd :argc) // expected-error {{directive '#pragma omp distribute simd' cannot contain more than one 'if' clause with 'simd' name modifier}} 130 for (i = 0; i < argc; ++i) foo(); 131 #pragma omp teams 132 #pragma omp distribute simd if(simd : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{no more 'if' clause is allowed}} 133 for (i = 0; i < argc; ++i) foo(); 134 135 return tmain(argc, argv); 136 } 137