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