1 // RUN: %clang_cc1 -verify -fopenmp -o - %s -Wuninitialized
2 
3 // RUN: %clang_cc1 -verify -fopenmp-simd -o - %s -Wuninitialized
4 
5 // RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp -o - %s -Wuninitialized
6 
7 // RUN: %clang_cc1 -verify -fopenmp-version=51 -DOMP51 -fopenmp-simd -o - %s -Wuninitialized
8 
9 void foo();
10 
11 namespace {
12 static int y = 0;
13 }
14 static int x = 0;
15 
main(int argc,char ** argv)16 int main(int argc, char **argv) {
17 #pragma omp target teams default // expected-error {{expected '(' after 'default'}}
18   foo();
19 #pragma omp target teams default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
20   foo();
21 #pragma omp target teams default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
22   foo();
23 #pragma omp target teams default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
24   foo();
25 #pragma omp target teams default (shared), default(shared) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'default' clause}}
26   foo();
27 #pragma omp target teams default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
28   foo();
29 
30 #pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
31   ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
32 
33 #pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
34 #pragma omp parallel default(shared)
35   ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
36 
37 #ifndef OMP51
38 #pragma omp target teams default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
39   {
40     ++x;
41     ++y;
42   }
43 #endif
44 
45   return 0;
46 }
47