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