[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / target_parallel_default_messages.cpp
blob796f4da790349f063a8e1bd5b2fff0bc722d1348
1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -DOMP50 -fopenmp -fopenmp-version=50 -ferror-limit 100 -o - %s -Wuninitialized
7 // RUN: %clang_cc1 -verify -DOMP50 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - %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 parallel default // expected-error {{expected '(' after 'default'}}
18 foo();
19 #pragma omp target parallel default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
20 foo();
21 #pragma omp target parallel default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
22 foo();
23 #pragma omp target parallel default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
24 foo();
25 #pragma omp target parallel default (shared), default(shared) // expected-error {{directive '#pragma omp target parallel' cannot contain more than one 'default' clause}}
26 foo();
27 #pragma omp target parallel default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
28 foo();
30 #pragma omp target parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
31 ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
33 #pragma omp target parallel default(none)
34 foo();
35 #pragma omp target parallel default(shared)
36 ++argc;
37 #pragma omp target parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
38 #pragma omp parallel default(shared)
39 ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
41 #ifdef OMP50
42 #pragma omp target parallel default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
44 ++x;
45 ++y;
47 #pragma omp target parallel default(private) // expected-error {{data-sharing attribute 'private' in 'default' clause requires OpenMP version 5.1 or above}}
49 ++x;
50 ++y;
52 #endif // OMP50
54 return 0;