[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / taskloop_grainsize_messages.cpp
blobf5f431206becee16d7b245608632bf5ed3f0aa39
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 taskloop grainsize // expected-error {{expected '(' after 'grainsize'}}
20 for (int i = 0; i < 10; ++i)
21 foo();
22 #pragma omp taskloop 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 taskloop grainsize () // expected-error {{expected expression}}
26 for (int i = 0; i < 10; ++i)
27 foo();
28 #pragma omp taskloop grainsize (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
29 for (int i = 0; i < 10; ++i)
30 foo();
31 #pragma omp taskloop grainsize (argc)) // expected-warning {{extra tokens at the end of '#pragma omp taskloop' are ignored}}
32 for (int i = 0; i < 10; ++i)
33 foo();
34 #pragma omp taskloop grainsize (argc > 0 ? argv[1][0] : argv[2][argc] + z)
35 for (int i = 0; i < 10; ++i)
36 foo();
37 #pragma omp taskloop grainsize (foobool(argc)), grainsize (true) // expected-error {{directive '#pragma omp taskloop' cannot contain more than one 'grainsize' clause}}
38 for (int i = 0; i < 10; ++i)
39 foo();
40 #pragma omp taskloop grainsize (S) // expected-error {{'S' does not refer to a value}}
41 for (int i = 0; i < 10; ++i)
42 foo();
43 #pragma omp taskloop grainsize (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
44 for (int i = 0; i < 10; ++i)
45 foo();
46 #pragma omp taskloop 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 taskloop 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 taskloop 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 #pragma omp taskloop grainsize // expected-error {{expected '(' after 'grainsize'}}
62 for (int i = 0; i < 10; ++i)
63 foo();
64 #pragma omp taskloop grainsize ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
65 for (int i = 0; i < 10; ++i)
66 foo();
67 #pragma omp taskloop grainsize () // expected-error {{expected expression}}
68 for (int i = 0; i < 10; ++i)
69 foo();
70 #pragma omp taskloop grainsize (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
71 for (int i = 0; i < 10; ++i)
72 foo();
73 #pragma omp taskloop grainsize (argc)) // expected-warning {{extra tokens at the end of '#pragma omp taskloop' are ignored}}
74 for (int i = 0; i < 10; ++i)
75 foo();
76 #pragma omp taskloop grainsize (argc > 0 ? argv[1][0] : argv[2][argc] + z)
77 for (int i = 0; i < 10; ++i)
78 foo();
79 #pragma omp taskloop grainsize (foobool(argc)), grainsize (true) // expected-error {{directive '#pragma omp taskloop' cannot contain more than one 'grainsize' clause}}
80 for (int i = 0; i < 10; ++i)
81 foo();
82 #pragma omp taskloop grainsize (S1) // expected-error {{'S1' does not refer to a value}}
83 for (int i = 0; i < 10; ++i)
84 foo();
85 #pragma omp taskloop grainsize (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
86 for (int i = 0; i < 10; ++i)
87 foo();
88 #pragma omp taskloop grainsize (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
89 for (int i = 0; i < 10; ++i)
90 foo();
91 #pragma omp taskloop grainsize(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
92 for (int i = 0; i < 10; ++i)
93 foo();
94 #pragma omp taskloop grainsize(0) // expected-error {{argument to 'grainsize' clause must be a strictly positive integer value}}
95 for (int i = 0; i < 10; ++i)
96 foo();
97 #pragma omp taskloop grainsize(-1) // expected-error {{argument to 'grainsize' clause must be a strictly positive integer value}}
98 for (int i = 0; i < 10; ++i)
99 foo();
100 #pragma omp taskloop 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}}
101 for (int i = 0; i < 10; ++i)
102 foo();
104 return tmain(argc, argv);