[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / distribute_parallel_for_default_messages.cpp
bloba85d7ad4a805df5857cf9027a020868140ff888c
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ferror-limit 100 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -DOMP51 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
7 // RUN: %clang_cc1 -verify -DOMP51 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
9 void foo();
11 namespace {
12 static int y = 0;
14 static int x = 0;
16 template <class T, int N>
17 T tmain(T argc) {
18 int i;
19 #pragma omp target
20 #pragma omp teams
21 #pragma omp distribute parallel for default // expected-error {{expected '(' after 'default'}}
22 for (i = 0; i < argc; ++i)
23 foo();
24 #pragma omp target
25 #pragma omp teams
26 #pragma omp distribute parallel for default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27 for (i = 0; i < argc; ++i)
28 foo();
29 #pragma omp target
30 #pragma omp teams
31 #pragma omp distribute parallel for default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
32 for (i = 0; i < argc; ++i)
33 foo();
34 #pragma omp target
35 #pragma omp teams
36 #pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note 2 {{explicit data sharing attribute requested here}}
37 for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
38 foo();
39 #pragma omp target
40 #pragma omp teams
41 #pragma omp distribute parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'default' clause}}
42 for (i = 0; i < argc; ++i)
43 foo();
44 #pragma omp target
45 #pragma omp teams
46 #pragma omp distribute parallel for default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
47 for (i = 0; i < argc; ++i)
48 foo();
49 #pragma omp target
50 #pragma omp teams
51 #pragma omp distribute parallel for default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
52 for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
53 foo();
55 #pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
56 #pragma omp target
57 #pragma omp teams
58 #pragma omp distribute parallel for default(shared)
59 for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
60 foo();
62 return T();
65 int main(int argc, char **argv) {
66 int i;
67 #pragma omp target
68 #pragma omp teams
69 #pragma omp distribute parallel for default // expected-error {{expected '(' after 'default'}}
70 for (i = 0; i < argc; ++i)
71 foo();
72 #pragma omp target
73 #pragma omp teams
74 #pragma omp distribute parallel for default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
75 for (i = 0; i < argc; ++i)
76 foo();
77 #pragma omp target
78 #pragma omp teams
79 #pragma omp distribute parallel for default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
80 for (i = 0; i < argc; ++i)
81 foo();
82 #pragma omp target
83 #pragma omp teams
84 #pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
85 for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
86 foo();
87 #pragma omp target
88 #pragma omp teams
89 #pragma omp distribute parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'default' clause}}
90 for (i = 0; i < argc; ++i)
91 foo();
92 #pragma omp target
93 #pragma omp teams
94 #pragma omp distribute parallel for default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
95 for (i = 0; i < argc; ++i)
96 foo();
97 #pragma omp target
98 #pragma omp teams
99 #pragma omp distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
100 for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
101 foo();
103 #pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
104 #pragma omp target
105 #pragma omp teams
106 #pragma omp distribute parallel for default(shared)
107 for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
108 foo();
110 #ifdef OMP51
111 #pragma omp target
112 #pragma omp teams
113 #pragma omp distribute parallel for default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}
114 for (i = 0; i < argc; ++i) {
115 ++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
116 ++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
118 #pragma omp target
119 #pragma omp teams
120 #pragma omp distribute parallel for default(private) // expected-note 2 {{explicit data sharing attribute requested here}}
121 for (i = 0; i < argc; ++i) {
122 ++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}
123 ++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}
125 #endif
127 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}}