Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_teams_distribute_parallel_for_default_messages.cpp
blob3e0b9f5b9cdd5559260219548ae8d4cd283000f8
1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp-version=50 -DOMP50 -fopenmp %s -Wuninitialized
7 // RUN: %clang_cc1 -verify -fopenmp-version=50 -DOMP50 -fopenmp-simd %s -Wuninitialized
9 void foo();
11 namespace {
12 static int y = 0;
14 static int x = 0;
16 int main(int argc, char **argv) {
17 #pragma omp target teams distribute parallel for default // expected-error {{expected '(' after 'default'}}
18 for (int i=0; i<200; i++) foo();
19 #pragma omp target teams distribute parallel for default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
20 for (int i=0; i<200; i++) foo();
21 #pragma omp target teams distribute parallel for default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
22 for (int i=0; i<200; i++) foo();
23 #pragma omp target teams distribute parallel for default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
24 for (int i=0; i<200; i++) foo();
25 #pragma omp target teams distribute parallel for default (shared), default(shared) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'default' clause}}
26 for (int i=0; i<200; i++) foo();
27 #pragma omp target teams distribute parallel for default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
28 for (int i=0; i<200; i++) foo();
30 #pragma omp target teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
31 for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
33 #ifdef OMP50
34 #pragma omp target teams distribute parallel for default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
35 for (int i = 0; i < 200; i++) {
36 ++x;
37 ++y;
39 #pragma omp target teams distribute parallel for default(private) // expected-error {{data-sharing attribute 'private' in 'default' clause requires OpenMP version 5.1 or above}}
40 for (int i = 0; i < 200; i++) {
41 ++x;
42 ++y;
44 #endif // OMP50
46 return 0;