scanner: Parse comments with */ not on a new line, but emit a warning
[platform/upstream/gobject-introspection.git] / tests / warn / annotationparser.h
1 #include "common.h"
2
3 /**
4  * test_symbol_twice_documented:
5  *
6  * Documenting the same thing multiple times can lead to subtle bugs.
7  * For example, one comment block might have correct annotations...
8  **/
9 void test_symbol_twice_documented();
10
11 /**
12  * test_symbol_twice_documented:
13  *
14  * ...and a different comment block (out of sync with the above) might have
15  * no annotations at all. The last comment block seen by the parser "wins".
16  **/
17
18 // EXPECT:12: Warning: Test: multiple comment blocks documenting 'test_symbol_twice_documented:' identifier.
19
20
21 /**
22  * test_symbol_missing_colon
23  *
24  * Forgotten colon above will result in a warning.
25  **/
26
27 // EXPECT:22: Warning: Test: missing ':' at column 29:
28 //+ * test_symbol_missing_colon
29 //+                            ^
30
31
32 /**
33  * GtkWidget:test_property_missing_colon
34  *
35  * Forgotten colon above will result in a warning.
36  **/
37
38 // EXPECT:33: Warning: Test: missing ':' at column 41:
39 //+ * GtkWidget:test_property_missing_colon
40 //+                                        ^
41
42
43 /**
44  * GtkWidget::test_signal_missing_colon
45  *
46  * Forgotten colon above will result in a warning.
47  **/
48
49 // EXPECT:44: Warning: Test: missing ':' at column 40:
50 //+ * GtkWidget::test_signal_missing_colon
51 //+                                       ^
52
53
54 /**
55  * This is not a valid section identifier
56  * SECTION:test_invalid_section_idetifier
57  *
58  * Above identifier will result in a warning.
59  **/
60
61 // EXPECT:55: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
62 //+ * This is not a valid section identifier
63 //+   ^
64
65
66 /**
67  * test_unexpected_parameter:
68  * @param1: first parameter
69  *
70  * Parameters should come before the comment block description
71  *
72  * Returns: something
73  * @param2: second parameter
74  **/
75
76 // EXPECT:73: Warning: Test: '@param2' parameter unexpected at this location:
77 //+ * @param2: second parameter
78 //+    ^
79
80
81 /**
82  * test_multiple_returns_tag_and_parameter:
83  *
84  * Multiple return value warnings are checked for when a returns
85  * parameter is encountered.
86  *
87  * Return Value: something
88  * @returns: something
89  */
90
91 // EXPECT:88: Warning: Test: '@returns' parameter unexpected at this location:
92 //+ * @returns: something
93 //+    ^
94 // EXPECT:88: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag_and_parameter'.
95
96
97 /**
98  * test_multiple_parameters:
99  * @param1: first parameter
100  * @param1: first parameter
101  **/
102
103 // EXPECT:100: Warning: Test: multiple '@param1' parameters for identifier 'test_multiple_parameters':
104 //+ * @param1: first parameter
105 //+    ^
106
107
108 /**
109  * test_unexpected_tag:
110  * @param1: first parameter
111  * Returns: something
112  *
113  * Tags should go after the comment block description
114  **/
115
116 // EXPECT:111: Warning: Test: 'Returns:' tag unexpected at this location:
117 //+ * Returns: something
118 //+   ^
119
120
121 /**
122  * test_multiple_returns_tag:
123  * @returns: something
124  *
125  * Multiple return value warnings are checked for when returns tag is used
126  *
127  * Returns: anything
128  * Return value: whatever
129  **/
130
131 // EXPECT:127: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag'.
132 // EXPECT:128: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag'.
133
134
135 /**
136  * test_multiple_tags:
137  *
138  * Since: 3.0
139  * Since: 3.0
140  **/
141
142 // EXPECT:139: Warning: Test: multiple 'Since:' tags for identifier 'test_multiple_tags':
143 //+ * Since: 3.0
144 //+   ^
145
146
147 /**
148  * test_tag_annotatable:
149  *
150  * There's currently 2 tags that can be annotated, so these don't emit warnings
151  *
152  * Returns: (allow-none): something
153  * Attributes: (free) (form) (annotations)
154  **/
155
156 /**
157  * test_tag_not_annotatable:
158  *
159  * Tags (except Returns: and Attributes:) don't have annotations
160  *
161  * Since: (allow-none): 2.24
162  **/
163
164 // EXPECT:161: Warning: Test: annotations not supported for tag 'Since:'.
165
166
167 /**
168  * test_multiline_annotations_on_parameter:
169  * @param1: (allow-none)
170  * (transfer full): first parameter
171  *
172  * Annotations spanning multiple lines are not valid
173  **/
174
175 // EXPECT:170: Warning: Test: ignoring invalid multiline annotation continuation:
176 //+ * (transfer full): first parameter
177 //+   ^
178
179
180 /**
181  * test_multiline_annotations_on_tag:
182  *
183  * Annotations spanning multiple lines are not valid
184  *
185  * Returns: (allow-none)
186  * (transfer full): something
187  **/
188
189 // EXPECT:186: Warning: Test: ignoring invalid multiline annotation continuation:
190 //+ * (transfer full): something
191 //+   ^
192
193
194 /**
195
196  * regress_test_invalid_comment:
197  * @foo: a param
198  *
199  * invalid comment with a line without
200  * https://bugzilla.gnome.org/show_bug.cgi?id=673806
201  */
202
203 // EXPECT:195: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
204 //+
205 //+^
206
207 /**
208  * regress_test_invalid_comment_end:
209  * @foo: a param
210  *
211  * invalid comment with a line without
212  * https://bugzilla.gnome.org/show_bug.cgi?id=689354 */
213
214 // EXPECT:212: Warning: Test: Comments should end with */ on a new line:
215 //+ * https://bugzilla.gnome.org/show_bug.cgi?id=689354 */
216 //+                                                    ^