1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
2 
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
4 
5 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized -fopenmp-version=51 -DOMP51
6 
7 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized -fopenmp-version=51 -DOMP51
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
18   #pragma omp teams distribute parallel for simd default // expected-error {{expected '(' after 'default'}}
19   for (int i=0; i<200; i++) foo();
20   #pragma omp target
21 #pragma omp teams distribute parallel for simd default( // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
22   for (int i=0; i<200; i++) foo();
23   #pragma omp target
24 #pragma omp teams distribute parallel for simd default() // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
25   for (int i=0; i<200; i++) foo();
26   #pragma omp target
27   #pragma omp teams distribute parallel for simd default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
28   for (int i=0; i<200; i++) foo();
29   #pragma omp target
30   #pragma omp teams distribute parallel for simd default (shared), default(shared) // expected-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'default' clause}}
31   for (int i=0; i<200; i++) foo();
32   #pragma omp target
33 #pragma omp teams distribute parallel for simd default(x) // expected-error {{expected 'none', 'shared' or 'firstprivate' in OpenMP clause 'default'}}
34   for (int i=0; i<200; i++) foo();
35 
36   #pragma omp target
37   #pragma omp teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
38   for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
39 
40 #ifdef OpenMP51
41 #pragma omp teams distribute parallel for default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
42   for (int i = 0; i < 200; i++) {
43     ++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
44     ++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
45   }
46 #endif
47 
48   return 0;
49 }
50