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