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