1 | // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s |
2 | |
3 | // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s |
4 | |
5 | void foo() { |
6 | } |
7 | |
8 | static int pvt; |
9 | #pragma omp threadprivate(pvt) |
10 | |
11 | #pragma omp target teams distribute parallel for simd // expected-error {{unexpected OpenMP directive '#pragma omp target teams distribute parallel for simd'}} |
12 | |
13 | int main(int argc, char **argv) { |
14 | #pragma omp target teams distribute parallel for simd { // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}} |
15 | for (int i = 0; i < argc; ++i) |
16 | foo(); |
17 | #pragma omp target teams distribute parallel for simd ( // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}} |
18 | for (int i = 0; i < argc; ++i) |
19 | foo(); |
20 | #pragma omp target teams distribute parallel for simd[ // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}} |
21 | for (int i = 0; i < argc; ++i) |
22 | foo(); |
23 | #pragma omp target teams distribute parallel for simd] // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}} |
24 | for (int i = 0; i < argc; ++i) |
25 | foo(); |
26 | #pragma omp target teams distribute parallel for simd) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}} |
27 | for (int i = 0; i < argc; ++i) |
28 | foo(); |
29 | #pragma omp target teams distribute parallel for simd } // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}} |
30 | for (int i = 0; i < argc; ++i) |
31 | foo(); |
32 | #pragma omp target teams distribute parallel for simd |
33 | for (int i = 0; i < argc; ++i) |
34 | foo(); |
35 | |
36 | // expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}} |
37 | #pragma omp target teams distribute parallel for simd unknown() |
38 | for (int i = 0; i < argc; ++i) |
39 | foo(); |
40 | L1: |
41 | for (int i = 0; i < argc; ++i) |
42 | foo(); |
43 | #pragma omp target teams distribute parallel for simd |
44 | for (int i = 0; i < argc; ++i) |
45 | foo(); |
46 | #pragma omp target teams distribute parallel for simd |
47 | for (int i = 0; i < argc; ++i) { |
48 | goto L1; // expected-error {{use of undeclared label 'L1'}} |
49 | argc++; |
50 | } |
51 | |
52 | for (int i = 0; i < 10; ++i) { |
53 | switch (argc) { |
54 | case (0): |
55 | #pragma omp target teams distribute parallel for simd |
56 | for (int i = 0; i < argc; ++i) { |
57 | foo(); |
58 | break; // expected-error {{'break' statement cannot be used in OpenMP for loop}} |
59 | continue; |
60 | } |
61 | default: |
62 | break; |
63 | } |
64 | } |
65 | #pragma omp target teams distribute parallel for simd default(none) |
66 | for (int i = 0; i < 10; ++i) |
67 | ++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}} |
68 | |
69 | goto L2; // expected-error {{use of undeclared label 'L2'}} |
70 | #pragma omp target teams distribute parallel for simd |
71 | for (int i = 0; i < argc; ++i) |
72 | L2: |
73 | foo(); |
74 | #pragma omp target teams distribute parallel for simd |
75 | for (int i = 0; i < argc; ++i) { |
76 | return 1; // expected-error {{cannot return from OpenMP region}} |
77 | } |
78 | |
79 | [[]] // expected-error {{an attribute list cannot appear here}} |
80 | #pragma omp target teams distribute parallel for simd |
81 | for (int n = 0; n < 100; ++n) { |
82 | } |
83 | |
84 | #pragma omp target teams distribute parallel for simd copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp target teams distribute parallel for simd'}} |
85 | for (int n = 0; n < 100; ++n) {} |
86 | |
87 | return 0; |
88 | } |
89 | |
90 | void test_ordered() { |
91 | #pragma omp target teams distribute parallel for simd ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp target teams distribute parallel for simd'}} |
92 | for (int i = 0; i < 16; ++i) |
93 | ; |
94 | } |
95 | |
96 | |