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