1 // RUN: %clang_cc1 -verify=expected,lt50,lt51 -fopenmp -fopenmp-version=45 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized 2 // RUN: %clang_cc1 -verify=expected,ge50,lt51 -fopenmp -fopenmp-version=50 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized 3 // RUN: %clang_cc1 -verify=expected,ge50,ge51 -fopenmp -fopenmp-version=51 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized 4 5 // RUN: %clang_cc1 -verify=expected,lt50,lt51 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized 6 // RUN: %clang_cc1 -verify=expected,ge50,lt51 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized 7 // RUN: %clang_cc1 -verify=expected,ge50,ge51 -fopenmp-simd -fopenmp-version=51 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized 8 9 void xxx(int argc) { 10 int x; // expected-note {{initialize the variable 'x' to silence this warning}} 11 #pragma omp target update to(x) 12 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}} 13 } 14 15 void foo() { 16 } 17 18 bool foobool(int argc) { 19 return argc; 20 } 21 22 struct S1; // Aexpected-note {{declared here}} 23 24 template <class T, class S> // Aexpected-note {{declared here}} 25 int tmain(T argc, S **argv) { 26 int n; 27 return 0; 28 } 29 30 struct S { 31 int i; 32 }; 33 34 int main(int argc, char **argv) { 35 int m; 36 #pragma omp target update // expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 37 #pragma omp target update to(m) { // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} 38 #pragma omp target update to(m) ( // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} 39 #pragma omp target update to(m) [ // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} 40 #pragma omp target update to(m) ] // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} 41 #pragma omp target update to(m) ) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} 42 43 #pragma omp declare mapper(id: S s) map(s.i) 44 S s; 45 46 // Check parsing with no modifiers. 47 // lt51-error@+2 {{expected expression}} 48 // lt51-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 49 #pragma omp target update to(: s) 50 // expected-error@+2 {{expected expression}} 51 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 52 #pragma omp target update to(:) 53 // expected-error@+2 2 {{expected expression}} 54 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 55 #pragma omp target update to(,:) 56 57 // Check parsing with one modifier. 58 // expected-error@+2 {{use of undeclared identifier 'foobar'}} 59 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 60 #pragma omp target update to(foobar: s) 61 // expected-error@+3 {{expected ',' or ')' in 'to' clause}} 62 // expected-error@+2 {{expected ')'}} 63 // expected-note@+1 {{to match this '('}} 64 #pragma omp target update to(m: s) 65 #pragma omp target update to(mapper(id): s) 66 // lt51-error@+2 {{use of undeclared identifier 'present'}} 67 // lt51-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 68 #pragma omp target update to(present: s) 69 // ge51-warning@+4 {{missing ':' after motion modifier - ignoring}} 70 // lt51-warning@+3 {{missing ':' after ) - ignoring}} 71 // expected-error@+2 {{expected expression}} 72 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 73 #pragma omp target update to(mapper(id) s) 74 // ge51-warning@+4 {{missing ':' after motion modifier - ignoring}} 75 // ge51-error@+3 {{expected expression}} 76 // lt51-error@+2 {{use of undeclared identifier 'present'}} 77 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 78 #pragma omp target update to(present s) 79 // ge51-warning@+4 {{missing ':' after motion modifier - ignoring}} 80 // lt51-warning@+3 {{missing ':' after ) - ignoring}} 81 // expected-error@+2 {{expected expression}} 82 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 83 #pragma omp target update to(mapper(id)) 84 // ge51-warning@+4 {{missing ':' after motion modifier - ignoring}} 85 // ge51-error@+3 {{expected expression}} 86 // lt51-error@+2 {{use of undeclared identifier 'present'}} 87 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 88 #pragma omp target update to(present) 89 // expected-error@+2 {{expected expression}} 90 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 91 #pragma omp target update to(mapper(id):) 92 // ge51-error@+3 {{expected expression}} 93 // lt51-error@+2 {{use of undeclared identifier 'present'}} 94 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 95 #pragma omp target update to(present:) 96 97 // Check parsing with two modifiers. 98 // lt51-warning@+1 {{missing ':' after ) - ignoring}} 99 #pragma omp target update to(mapper(id), present: s) 100 // lt51-error@+3 {{use of undeclared identifier 'present'}} 101 // lt51-error@+2 {{use of undeclared identifier 'id'}} 102 // lt51-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 103 #pragma omp target update to(present, mapper(id): s) 104 // lt51-warning@+1 {{missing ':' after ) - ignoring}} 105 #pragma omp target update to(mapper(id) present: s) 106 // lt51-error@+2 {{use of undeclared identifier 'present'}} 107 // lt51-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 108 #pragma omp target update to(present mapper(id): s) 109 110 // Check parsing with unnecessary commas. 111 // lt51-warning@+1 {{missing ':' after ) - ignoring}} 112 #pragma omp target update to(mapper(id),: s) 113 // lt51-error@+3 {{use of undeclared identifier 'present'}} 114 // lt51-error@+2 {{expected expression}} 115 // lt51-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 116 #pragma omp target update to(present , : s) 117 // ge51-warning@+2 {{missing ':' after motion modifier - ignoring}} 118 // lt51-warning@+1 {{missing ':' after ) - ignoring}} 119 #pragma omp target update to(mapper(id),,: s) 120 // ge51-warning@+5 {{missing ':' after motion modifier - ignoring}} 121 // lt51-error@+4 {{use of undeclared identifier 'present'}} 122 // lt51-error@+3 {{expected expression}} 123 // lt51-error@+2 {{expected expression}} 124 // lt51-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 125 #pragma omp target update to(present,,: s) 126 // lt51-warning@+1 {{missing ':' after ) - ignoring}} 127 #pragma omp target update to(mapper(id), present,: s) 128 // lt51-error@+4 {{use of undeclared identifier 'present'}} 129 // lt51-error@+3 {{use of undeclared identifier 'id'}} 130 // lt51-error@+2 {{expected expression}} 131 // lt51-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 132 #pragma omp target update to(present, mapper(id),: s) 133 134 #pragma omp target update from(m) allocate(m) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp target update'}} 135 { 136 foo(); 137 } 138 139 int iarr[5][5]; 140 // ge50-error@+4 {{section stride is evaluated to a non-positive value -1}} 141 // lt50-error@+3 {{expected ']'}} 142 // lt50-note@+2 {{to match this '['}} 143 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 144 #pragma omp target update to(iarr[0:][1:2:-1]) 145 {} 146 // ge50-error@+4 {{section stride is evaluated to a non-positive value -1}} 147 // lt50-error@+3 {{expected ']'}} 148 // lt50-note@+2 {{to match this '['}} 149 // expected-error@+1 {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} 150 #pragma omp target update from(iarr[0:][1:2:-1]) 151 152 return tmain(argc, argv); 153 } 154