1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
6 int x
; // expected-note {{initialize the variable 'x' to silence this warning}}
7 #pragma omp target teams distribute
8 for (int i
= 0; i
< 10; ++i
)
9 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
16 #pragma omp threadprivate(pvt)
18 #pragma omp target teams distribute // expected-error {{unexpected OpenMP directive '#pragma omp target teams distribute'}}
20 int main(int argc
, char **argv
) {
21 #pragma omp target teams distribute { // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
22 for (int i
= 0; i
< argc
; ++i
)
24 #pragma omp target teams distribute ( // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
25 for (int i
= 0; i
< argc
; ++i
)
27 #pragma omp target teams distribute[ // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
28 for (int i
= 0; i
< argc
; ++i
)
30 #pragma omp target teams distribute] // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
31 for (int i
= 0; i
< argc
; ++i
)
33 #pragma omp target teams distribute) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
34 for (int i
= 0; i
< argc
; ++i
)
36 #pragma omp target teams distribute } // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
37 for (int i
= 0; i
< argc
; ++i
)
39 #pragma omp target teams distribute
40 for (int i
= 0; i
< argc
; ++i
)
42 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
43 #pragma omp target teams distribute unknown()
44 for (int i
= 0; i
< argc
; ++i
)
47 for (int i
= 0; i
< argc
; ++i
)
49 #pragma omp target teams distribute
50 for (int i
= 0; i
< argc
; ++i
)
52 #pragma omp target teams distribute
53 for (int i
= 0; i
< argc
; ++i
) {
54 goto L1
; // expected-error {{use of undeclared label 'L1'}}
58 for (int i
= 0; i
< 10; ++i
) {
61 #pragma omp target teams distribute
62 for (int i
= 0; i
< argc
; ++i
) {
64 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
71 #pragma omp target teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}}
72 for (int i
= 0; i
< 10; ++i
)
73 ++argc
; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
75 goto L2
; // expected-error {{use of undeclared label 'L2'}}
76 #pragma omp target teams distribute
77 for (int i
= 0; i
< argc
; ++i
)
80 #pragma omp target teams distribute
81 for (int i
= 0; i
< argc
; ++i
) {
82 return 1; // expected-error {{cannot return from OpenMP region}}
85 [[]] // expected-error {{an attribute list cannot appear here}}
86 #pragma omp target teams distribute
87 for (int n
= 0; n
< 100; ++n
) {
90 #pragma omp target teams distribute copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp target teams distribute'}}
91 for (int n
= 0; n
< 100; ++n
) {}
97 #pragma omp target teams distribute ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp target teams distribute'}}
98 for (int i
= 0; i
< 16; ++i
)