Clang Project

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