1 | // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ferror-limit 100 %s |
2 | |
3 | // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s |
4 | |
5 | void foo() { |
6 | } |
7 | |
8 | bool foobool(int argc) { |
9 | return argc; |
10 | } |
11 | |
12 | struct S1; // expected-note {{declared here}} |
13 | |
14 | template <class T, class S> // expected-note {{declared here}} |
15 | int tmain(T argc, S **argv) { |
16 | T i; |
17 | #pragma omp target |
18 | #pragma omp teams distribute parallel for if // expected-error {{expected '(' after 'if'}} |
19 | for (i = 0; i < argc; ++i) foo(); |
20 | #pragma omp target |
21 | #pragma omp teams distribute parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
22 | for (i = 0; i < argc; ++i) foo(); |
23 | #pragma omp target |
24 | #pragma omp teams distribute parallel for if () // expected-error {{expected expression}} |
25 | for (i = 0; i < argc; ++i) foo(); |
26 | #pragma omp target |
27 | #pragma omp teams distribute parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
28 | for (i = 0; i < argc; ++i) foo(); |
29 | #pragma omp target |
30 | #pragma omp teams distribute parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}} |
31 | for (i = 0; i < argc; ++i) foo(); |
32 | #pragma omp target |
33 | #pragma omp teams distribute parallel for if (argc > 0 ? argv[1] : argv[2]) |
34 | for (i = 0; i < argc; ++i) foo(); |
35 | #pragma omp target |
36 | #pragma omp teams distribute parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'if' clause}} |
37 | for (i = 0; i < argc; ++i) foo(); |
38 | #pragma omp target |
39 | #pragma omp teams distribute parallel for if (S) // expected-error {{'S' does not refer to a value}} |
40 | for (i = 0; i < argc; ++i) foo(); |
41 | #pragma omp target |
42 | #pragma omp teams distribute parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
43 | for (i = 0; i < argc; ++i) foo(); |
44 | #pragma omp target |
45 | #pragma omp teams distribute parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
46 | for (i = 0; i < argc; ++i) foo(); |
47 | #pragma omp target |
48 | #pragma omp teams distribute parallel for if(argc) |
49 | for (i = 0; i < argc; ++i) foo(); |
50 | #pragma omp target |
51 | #pragma omp teams distribute parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
52 | for (i = 0; i < argc; ++i) foo(); |
53 | #pragma omp target |
54 | #pragma omp teams distribute parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
55 | for (i = 0; i < argc; ++i) foo(); |
56 | #pragma omp target |
57 | #pragma omp teams distribute parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
58 | for (i = 0; i < argc; ++i) foo(); |
59 | #pragma omp target |
60 | #pragma omp teams distribute parallel for if(parallel : argc) |
61 | for (i = 0; i < argc; ++i) foo(); |
62 | #pragma omp target |
63 | #pragma omp teams distribute parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp teams distribute parallel for'}} |
64 | for (i = 0; i < argc; ++i) foo(); |
65 | #pragma omp target |
66 | #pragma omp teams distribute parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}} |
67 | for (i = 0; i < argc; ++i) foo(); |
68 | #pragma omp target |
69 | #pragma omp teams distribute parallel for if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}} |
70 | for (i = 0; i < argc; ++i) foo(); |
71 | #pragma omp target |
72 | #pragma omp teams distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp teams distribute parallel for'}} |
73 | for (i = 0; i < argc; ++i) foo(); |
74 | |
75 | return 0; |
76 | } |
77 | |
78 | int main(int argc, char **argv) { |
79 | int i; |
80 | #pragma omp target |
81 | #pragma omp teams distribute parallel for if // expected-error {{expected '(' after 'if'}} |
82 | for (i = 0; i < argc; ++i) foo(); |
83 | #pragma omp target |
84 | #pragma omp teams distribute parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
85 | for (i = 0; i < argc; ++i) foo(); |
86 | #pragma omp target |
87 | #pragma omp teams distribute parallel for if () // expected-error {{expected expression}} |
88 | for (i = 0; i < argc; ++i) foo(); |
89 | #pragma omp target |
90 | #pragma omp teams distribute parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
91 | for (i = 0; i < argc; ++i) foo(); |
92 | #pragma omp target |
93 | #pragma omp teams distribute parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}} |
94 | for (i = 0; i < argc; ++i) foo(); |
95 | #pragma omp target |
96 | #pragma omp teams distribute parallel for if (argc > 0 ? argv[1] : argv[2]) |
97 | for (i = 0; i < argc; ++i) foo(); |
98 | #pragma omp target |
99 | #pragma omp teams distribute parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'if' clause}} |
100 | for (i = 0; i < argc; ++i) foo(); |
101 | #pragma omp target |
102 | #pragma omp teams distribute parallel for if (S1) // expected-error {{'S1' does not refer to a value}} |
103 | for (i = 0; i < argc; ++i) foo(); |
104 | #pragma omp target |
105 | #pragma omp teams distribute parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
106 | for (i = 0; i < argc; ++i) foo(); |
107 | #pragma omp target |
108 | #pragma omp teams distribute parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
109 | for (i = 0; i < argc; ++i) foo(); |
110 | #pragma omp target |
111 | #pragma omp teams distribute parallel for if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
112 | for (i = 0; i < argc; ++i) foo(); |
113 | #pragma omp target |
114 | #pragma omp teams distribute parallel for if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
115 | for (i = 0; i < argc; ++i) foo(); |
116 | #pragma omp target |
117 | #pragma omp teams distribute parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
118 | for (i = 0; i < argc; ++i) foo(); |
119 | #pragma omp target |
120 | #pragma omp teams distribute parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
121 | for (i = 0; i < argc; ++i) foo(); |
122 | #pragma omp target |
123 | #pragma omp teams distribute parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
124 | for (i = 0; i < argc; ++i) foo(); |
125 | #pragma omp target |
126 | #pragma omp teams distribute parallel for if(parallel : argc) |
127 | for (i = 0; i < argc; ++i) foo(); |
128 | #pragma omp target |
129 | #pragma omp teams distribute parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp teams distribute parallel for'}} |
130 | for (i = 0; i < argc; ++i) foo(); |
131 | #pragma omp target |
132 | #pragma omp teams distribute parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}} |
133 | for (i = 0; i < argc; ++i) foo(); |
134 | #pragma omp target |
135 | #pragma omp teams distribute parallel for if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}} |
136 | for (i = 0; i < argc; ++i) foo(); |
137 | #pragma omp target |
138 | #pragma omp teams distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp teams distribute parallel for'}} |
139 | for (i = 0; i < argc; ++i) foo(); |
140 | |
141 | return tmain(argc, argv); |
142 | } |
143 | |