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