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