[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / masked_taskloop_simd_grainsize_messages.cpp
blob10b40b6cb580f45368e88be23d89c87625fd3697
1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
2 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ferror-limit 100 %s -Wuninitialized
4 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp-version=51 -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
7 void foo() {
10 bool foobool(int argc) {
11 return argc;
14 struct S1; // expected-note {{declared here}}
16 template <class T, class S> // expected-note {{declared here}}
17 int tmain(T argc, S **argv) {
18 T z;
19 #pragma omp masked taskloop simd grainsize // expected-error {{expected '(' after 'grainsize'}}
20 for (int i = 0; i < 10; ++i)
21 foo();
22 #pragma omp masked taskloop simd grainsize ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
23 for (int i = 0; i < 10; ++i)
24 foo();
25 #pragma omp masked taskloop simd grainsize () // expected-error {{expected expression}}
26 for (int i = 0; i < 10; ++i)
27 foo();
28 #pragma omp masked taskloop simd grainsize (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
29 for (int i = 0; i < 10; ++i)
30 foo();
31 #pragma omp masked taskloop simd grainsize (z + argc)) // expected-warning {{extra tokens at the end of '#pragma omp masked taskloop simd' are ignored}}
32 for (int i = 0; i < 10; ++i)
33 foo();
34 #pragma omp masked taskloop simd grainsize (argc > 0 ? argv[1][0] : argv[2][argc])
35 for (int i = 0; i < 10; ++i)
36 foo();
37 #pragma omp masked taskloop simd grainsize (foobool(argc)), grainsize (true) // expected-error {{directive '#pragma omp masked taskloop simd' cannot contain more than one 'grainsize' clause}}
38 for (int i = 0; i < 10; ++i)
39 foo();
40 #pragma omp masked taskloop simd grainsize (S) // expected-error {{'S' does not refer to a value}}
41 for (int i = 0; i < 10; ++i)
42 foo();
43 #pragma omp masked taskloop simd grainsize (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
44 for (int i = 0; i < 10; ++i)
45 foo();
46 #pragma omp masked taskloop simd grainsize(0) // expected-error {{argument to 'grainsize' clause must be a strictly positive integer value}}
47 for (int i = 0; i < 10; ++i)
48 foo();
49 #pragma omp masked taskloop simd grainsize(-1) // expected-error {{argument to 'grainsize' clause must be a strictly positive integer value}}
50 for (int i = 0; i < 10; ++i)
51 foo();
52 #pragma omp masked taskloop simd grainsize(argc) num_tasks(argc) // expected-error {{'num_tasks' and 'grainsize' clause are mutually exclusive and may not appear on the same directive}} expected-note {{'grainsize' clause is specified here}}
53 for (int i = 0; i < 10; ++i)
54 foo();
56 return 0;
59 int main(int argc, char **argv) {
60 int z;
61 int tid = 0;
62 #pragma omp masked taskloop simd filter(tid) grainsize // expected-error {{expected '(' after 'grainsize'}}
63 for (int i = 0; i < 10; ++i)
64 foo();
65 #pragma omp masked taskloop simd grainsize ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
66 for (int i = 0; i < 10; ++i)
67 foo();
68 #pragma omp masked taskloop simd grainsize () // expected-error {{expected expression}}
69 for (int i = 0; i < 10; ++i)
70 foo();
71 #pragma omp masked taskloop simd grainsize (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
72 for (int i = 0; i < 10; ++i)
73 foo();
74 #pragma omp masked taskloop simd grainsize (argc+z)) // expected-warning {{extra tokens at the end of '#pragma omp masked taskloop simd' are ignored}}
75 for (int i = 0; i < 10; ++i)
76 foo();
77 #pragma omp masked taskloop simd grainsize (argc > 0 ? argv[1][0] : argv[2][argc])
78 for (int i = 0; i < 10; ++i)
79 foo();
80 #pragma omp masked taskloop simd grainsize (foobool(argc)), grainsize (true) // expected-error {{directive '#pragma omp masked taskloop simd' cannot contain more than one 'grainsize' clause}}
81 for (int i = 0; i < 10; ++i)
82 foo();
83 #pragma omp masked taskloop simd grainsize (S1) // expected-error {{'S1' does not refer to a value}}
84 for (int i = 0; i < 10; ++i)
85 foo();
86 #pragma omp masked taskloop simd grainsize (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
87 for (int i = 0; i < 10; ++i)
88 foo();
89 #pragma omp masked taskloop simd grainsize (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
90 for (int i = 0; i < 10; ++i)
91 foo();
92 #pragma omp masked taskloop simd grainsize(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
93 for (int i = 0; i < 10; ++i)
94 foo();
95 #pragma omp masked taskloop simd grainsize(0) // expected-error {{argument to 'grainsize' clause must be a strictly positive integer value}}
96 for (int i = 0; i < 10; ++i)
97 foo();
98 #pragma omp masked taskloop simd grainsize(-1) // expected-error {{argument to 'grainsize' clause must be a strictly positive integer value}}
99 for (int i = 0; i < 10; ++i)
100 foo();
101 #pragma omp masked taskloop simd grainsize(argc) num_tasks(argc) // expected-error {{'num_tasks' and 'grainsize' clause are mutually exclusive and may not appear on the same directive}} expected-note {{'grainsize' clause is specified here}}
102 for (int i = 0; i < 10; ++i)
103 foo();
105 return tmain(argc, argv);