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