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