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