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