1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
6 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
7 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
10 int x
; // expected-note {{initialize the variable 'x' to silence this warning}}
11 #pragma omp parallel for
12 for(int i
= 0; i
< 10; ++i
)
13 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
19 #pragma omp parallel for // expected-error {{unexpected OpenMP directive '#pragma omp parallel for'}}
21 int main(int argc
, char **argv
) {
22 #pragma omp parallel for { // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
23 for (int i
= 0; i
< argc
; ++i
)
25 #pragma omp parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
26 for (int i
= 0; i
< argc
; ++i
)
28 #pragma omp parallel for[ // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
29 for (int i
= 0; i
< argc
; ++i
)
31 #pragma omp parallel for] // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
32 for (int i
= 0; i
< argc
; ++i
)
34 #pragma omp parallel for) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
35 for (int i
= 0; i
< argc
; ++i
)
37 #pragma omp parallel for } // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
38 for (int i
= 0; i
< argc
; ++i
)
40 #pragma omp parallel for
41 for (int i
= 0; i
< argc
; ++i
)
43 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
44 #pragma omp parallel for unknown()
45 for (int i
= 0; i
< argc
; ++i
)
48 for (int i
= 0; i
< argc
; ++i
)
50 #pragma omp parallel for
51 for (int i
= 0; i
< argc
; ++i
)
53 #pragma omp parallel for
54 for (int i
= 0; i
< argc
; ++i
) {
55 goto L1
; // expected-error {{use of undeclared label 'L1'}}
59 for (int i
= 0; i
< 10; ++i
) {
62 #pragma omp parallel for
63 for (int i
= 0; i
< argc
; ++i
) {
65 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
72 #pragma omp parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
73 for (int i
= 0; i
< 10; ++i
)
74 ++argc
; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
76 goto L2
; // expected-error {{use of undeclared label 'L2'}}
77 #pragma omp parallel for
78 for (int i
= 0; i
< argc
; ++i
)
81 #pragma omp parallel for
82 for (int i
= 0; i
< argc
; ++i
) {
83 return 1; // expected-error {{cannot return from OpenMP region}}
86 [[]] // expected-error {{an attribute list cannot appear here}}
87 #pragma omp parallel for
88 for (int n
= 0; n
< 100; ++n
) {
95 #pragma omp parallel for ordered ordered // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'ordered' clause}}
96 for (int i
= 0; i
< 16; ++i
)
98 #pragma omp parallel for order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} expected-error {{expected '(' after 'order'}}
99 for (int i
= 0; i
< 10; ++i
)
101 #pragma omp parallel for order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
102 for (int i
= 0; i
< 10; ++i
)
104 #pragma omp parallel for order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
105 for (int i
= 0; i
< 10; ++i
)
107 #pragma omp parallel for order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
108 for (int i
= 0; i
< 10; ++i
)
110 #pragma omp parallel for order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}}
111 for (int i
= 0; i
< 10; ++i
)
113 #pragma omp parallel for order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
114 for (int i
= 0; i
< 10; ++i
)
116 #pragma omp parallel for order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
117 for (int i
= 0; i
< 10; ++i
)
119 #pragma omp parallel for order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
120 for (int i
= 0; i
< 10; ++i
)
122 #pragma omp parallel for order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
123 for (int i
= 0; i
< 10; ++i
)
125 #pragma omp parallel for order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for'}} omp51-error {{directive '#pragma omp parallel for' cannot contain more than one 'order' clause}}
126 for (int i
= 0; i
< 10; ++i
)