xref: /llvm-project/clang/test/OpenMP/parallel_sections_default_messages.cpp (revision 0c6f2f629cc0017361310fa4c132090413a874db)
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ferror-limit 100 -o - %s \
2 // RUN:  -Wuninitialized
3 
4 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - %s \
5 // RUN:  -Wuninitialized
6 
7 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s \
8 // RUN:  -DOMP51 -Wuninitialized
9 
10 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s \
11 // RUN:  -DOMP51 -Wuninitialized
12 
13 void foo();
14 
main(int argc,char ** argv)15 int main(int argc, char **argv) {
16 #pragma omp parallel sections default // expected-error {{expected '(' after 'default'}}
17   {
18 #pragma omp parallel sections default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
19       {
20 #pragma omp parallel sections default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
21           {
22 #pragma omp parallel sections default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
23               {
24 #pragma omp parallel sections default(shared), default(shared) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'default' clause}}
25                   {
26 #pragma omp parallel sections default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
27                       {foo();
28             }
29           }
30         }
31       }
32     }
33   }
34 
35 #pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}}
36   {
37     ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
38   }
39 
40 #pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}}
41   {
42 #pragma omp parallel sections default(shared)
43     {
44       ++argc;  // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
45     }
46   }
47 
48 #ifdef OMP51
49 #pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}}
50   {
51 #pragma omp parallel sections default(private)
52     {
53       ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
54     }
55   }
56 #endif // OMP51
57   return 0;
58 }
59