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