blob: 3949b2ee49b9aa0c55cdecfe201c6ed2f13f32d8 [file] [log] [blame]
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +00001// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
2
3// expected-warning@+1 {{expected quoted string after equals sign}}
4/// <a href=>
5int test_html1(int);
6
7// expected-warning@+1 {{expected quoted string after equals sign}}
8/// <a href==>
9int test_html2(int);
10
11// expected-warning@+2 {{expected quoted string after equals sign}}
12// expected-warning@+1 {{HTML opening tag prematurely ended, expected attribute name or '>'}}
13/// <a href= blah
14int test_html3(int);
15
16// expected-warning@+1 {{HTML opening tag prematurely ended, expected attribute name or '>'}}
17/// <a =>
18int test_html4(int);
19
20// expected-warning@+1 {{HTML opening tag prematurely ended, expected attribute name or '>'}}
21/// <a "aaa">
22int test_html5(int);
23
24// expected-warning@+1 {{HTML opening tag prematurely ended, expected attribute name or '>'}}
25/// <a a="b" =>
26int test_html6(int);
27
28// expected-warning@+1 {{HTML opening tag prematurely ended, expected attribute name or '>'}}
29/// <a a="b" "aaa">
30int test_html7(int);
31
32// expected-warning@+1 {{HTML opening tag prematurely ended, expected attribute name or '>'}}
33/// <a a="b" =
34int test_html8(int);
35
36// expected-warning@+2 {{HTML opening tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
37/** Aaa bbb<ccc ddd eee
38 * fff ggg.
39 */
40int test_html9(int);
41
42// expected-warning@+1 {{HTML opening tag prematurely ended, expected attribute name or '>'}}
43/** Aaa bbb<ccc ddd eee 42%
44 * fff ggg.
45 */
46int test_html10(int);
47
48
49/// <blockquote>Meow</blockquote>
50int test_html_nesting1(int);
51
52/// <b><i>Meow</i></b>
53int test_html_nesting2(int);
54
55/// <p>Aaa<br>
56/// Bbb</p>
57int test_html_nesting3(int);
58
59/// <p>Aaa<br />
60/// Bbb</p>
61int test_html_nesting4(int);
62
63// expected-warning@+1 {{HTML closing tag does not match any opening tag}}
64/// <b><i>Meow</a>
65int test_html_nesting5(int);
66
67// expected-warning@+2 {{HTML opening tag 'i' closed by 'b'}}
68// expected-warning@+1 {{HTML closing tag does not match any opening tag}}
69/// <b><i>Meow</b></b>
70int test_html_nesting6(int);
71
72// expected-warning@+2 {{HTML opening tag 'i' closed by 'b'}}
73// expected-warning@+1 {{HTML closing tag does not match any opening tag}}
74/// <b><i>Meow</b></i>
75int test_html_nesting7(int);
76
77
78// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
79/// \brief\brief Aaa
80int test_block_command1(int);
81
82// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
83/// \brief \brief Aaa
84int test_block_command2(int);
85
86// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
87/// \brief
88/// \brief Aaa
89int test_block_command3(int);
90
91// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
92/// \brief
93///
94/// \brief Aaa
95int test_block_command4(int);
96
97// There is trailing whitespace on one of the following lines, don't remove it!
98// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
99/// \brief
100///
101/// \brief Aaa
102int test_block_command5(int);
103
104// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
105/// \param a Blah blah.
106int test_param1;
107
108// expected-warning@+1 {{empty paragraph passed to '\param' command}}
109/// \param
110/// \param a Blah blah.
111int test_param2(int a);
112
113// expected-warning@+1 {{empty paragraph passed to '\param' command}}
114/// \param a
115int test_param3(int a);
116
117/// \param a Blah blah.
118int test_param4(int a);
119
120/// \param [in] a Blah blah.
121int test_param5(int a);
122
123/// \param [out] a Blah blah.
124int test_param6(int a);
125
126/// \param [in,out] a Blah blah.
127int test_param7(int a);
128
129// expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
130/// \param [ in ] a Blah blah.
131int test_param8(int a);
132
133// expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
134/// \param [in, out] a Blah blah.
135int test_param9(int a);
136
137// expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
138/// \param [ junk] a Blah blah.
139int test_param10(int a);
140
141// expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
142/// \param A Blah blah.
143int test_param11(int a);
144
145// expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
146/// \param aab Blah blah.
147int test_param12(int aaa, int bbb);
148
149// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
150/// \param aab Blah blah.
151int test_param13(int bbb, int ccc);
152
153class C {
154 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
155 /// \param aaa Blah blah.
156 C(int bbb, int ccc);
157
158 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
159 /// \param aaa Blah blah.
160 int test_param14(int bbb, int ccc);
161};
162
163
164// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
165int test1; ///< \brief\brief Aaa
166
167// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
168// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
169int test2, ///< \brief\brief Aaa
170 test3; ///< \brief\brief Aaa
171
172// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
173int test4; ///< \brief
174 ///< \brief Aaa
175
176
177// Check that we attach the comment to the declaration during parsing in the
178// following cases. The test is based on the fact that we don't parse
179// documentation comments that are not attached to anything.
180
181// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
182/// \brief\brief Aaa
183int test_attach1;
184
185// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
186/// \brief\brief Aaa
187int test_attach2(int);
188
189// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
190/// \brief\brief Aaa
191struct test_attach3 {
192 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
193 /// \brief\brief Aaa
194 int test_attach4;
195
196 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
197 int test_attach5; ///< \brief\brief Aaa
198
199 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
200 /// \brief\brief Aaa
201 int test_attach6(int);
202};
203
204// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
205/// \brief\brief Aaa
206class test_attach7 {
207 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
208 /// \brief\brief Aaa
209 int test_attach8;
210
211 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
212 int test_attach9; ///< \brief\brief Aaa
213
214 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
215 /// \brief\brief Aaa
216 int test_attach10(int);
217};
218
219// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
220/// \brief\brief Aaa
221enum test_attach9 {
222 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
223 /// \brief\brief Aaa
224 test_attach10,
225
226 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
227 test_attach11 ///< \brief\brief Aaa
228};
229
230// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
231/// \brief\brief Aaa
232struct test_noattach12 *test_attach13;
233
234// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
235/// \brief\brief Aaa
236typedef struct test_noattach14 *test_attach15;
237
238// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
239/// \brief\brief Aaa
240typedef struct test_attach16 { int a; } test_attach17;
241
242struct S { int a; };
243
244// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
245/// \brief\brief Aaa
246struct S *test_attach18;
247
248// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
249/// \brief\brief Aaa
250typedef struct S *test_attach19;
251
252// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
253/// \brief\brief Aaa
254struct test_attach20;
255
256// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
257/// \brief\brief Aaa
258typedef struct test_attach21 {
259 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
260 /// \brief\brief Aaa
261 int test_attach22;
262} test_attach23;
263
264// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
265/// \brief\brief Aaa
266namespace test_attach24 {
267 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
268 /// \brief\brief Aaa
269 namespace test_attach25 {
270 }
271}
272