1 // RUN: %clang_cc1 -verify -fopenmp %s
2 
3 int foo();
4 
5 int main() {
6   #pragma omp master
7   ;
8   #pragma omp master nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp master'}}
9   #pragma omp master unknown // expected-warning {{extra tokens at the end of '#pragma omp master' are ignored}}
10   foo();
11   {
12     #pragma omp master
13   } // expected-error {{expected statement}}
14   #pragma omp for
15   for (int i = 0; i < 10; ++i) {
16     foo();
17     #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
18     foo();
19   }
20   #pragma omp sections
21   {
22     foo();
23     #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}}
24     foo();
25   }
26   #pragma omp single
27   for (int i = 0; i < 10; ++i) {
28     foo();
29     #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}}
30     foo();
31   }
32   #pragma omp master
33   for (int i = 0; i < 10; ++i) {
34     foo();
35     #pragma omp master
36     foo();
37   }
38   #pragma omp for ordered
39   for (int i = 0; i < 10; ++i)
40   #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
41   {
42     foo();
43   }
44 
45   return 0;
46 }
47 
48 int foo() {
49   L1:
50     foo();
51   #pragma omp master
52   {
53     foo();
54     goto L1; // expected-error {{use of undeclared label 'L1'}}
55   }
56   goto L2; // expected-error {{use of undeclared label 'L2'}}
57   #pragma omp master
58   {
59     L2:
60     foo();
61   }
62 
63   return 0;
64 }
65