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