summaryrefslogtreecommitdiff
path: root/tests/warn/annotationparser.h
blob: ff9030e4d6e890d9bc8fc5301757b711fbf5a75b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#include "common.h"

/**
 * test_symbol_twice_documented:
 *
 * Documenting the same thing multiple times can lead to subtle bugs.
 * For example, one comment block might have correct annotations...
 **/
void test_symbol_twice_documented();

/**
 * test_symbol_twice_documented:
 *
 * ...and a different comment block (out of sync with the above) might have
 * no annotations at all. The last comment block seen by the parser "wins".
 **/

// EXPECT:12: Warning: Test: multiple comment blocks documenting 'test_symbol_twice_documented:' identifier.


/**
 * test_symbol_missing_colon
 *
 * Forgotten colon above will result in a warning.
 **/

// EXPECT:22: Warning: Test: missing ':' at column 29:
//+ * test_symbol_missing_colon
//+                            ^


/**
 * GtkWidget:test_property_missing_colon
 *
 * Forgotten colon above will result in a warning.
 **/

// EXPECT:33: Warning: Test: missing ':' at column 41:
//+ * GtkWidget:test_property_missing_colon
//+                                        ^


/**
 * GtkWidget::test_signal_missing_colon
 *
 * Forgotten colon above will result in a warning.
 **/

// EXPECT:44: Warning: Test: missing ':' at column 40:
//+ * GtkWidget::test_signal_missing_colon
//+                                       ^


/**
 * This is not a valid section identifier
 * SECTION:test_invalid_section_idetifier
 *
 * Above identifier will result in a warning.
 **/

// EXPECT:55: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
//+ * This is not a valid section identifier
//+   ^


/**
 * test_unexpected_parameter:
 * @param1: first parameter
 *
 * Parameters should come before the comment block description
 *
 * Returns: something
 * @param2: second parameter
 **/

// EXPECT:73: Warning: Test: '@param2' parameter unexpected at this location:
//+ * @param2: second parameter
//+    ^


/**
 * test_multiple_returns_tag_and_parameter:
 *
 * Multiple return value warnings are checked for when a returns
 * parameter is encountered.
 *
 * Return Value: something
 * @returns: something
 */

// EXPECT:88: Warning: Test: '@returns' parameter unexpected at this location:
//+ * @returns: something
//+    ^
// EXPECT:88: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag_and_parameter'.


/**
 * test_multiple_parameters:
 * @param1: first parameter
 * @param1: first parameter
 **/

// EXPECT:100: Warning: Test: multiple '@param1' parameters for identifier 'test_multiple_parameters':
//+ * @param1: first parameter
//+    ^


/**
 * test_unexpected_tag:
 * @param1: first parameter
 * Returns: something
 *
 * Tags should go after the comment block description
 **/

// EXPECT:111: Warning: Test: 'Returns:' tag unexpected at this location:
//+ * Returns: something
//+   ^


/**
 * test_multiple_returns_tag:
 * @returns: something
 *
 * Multiple return value warnings are checked for when returns tag is used
 *
 * Returns: anything
 * Return value: whatever
 **/

// EXPECT:127: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag'.
// EXPECT:128: Warning: Test: encountered multiple 'Returns' parameters or tags for 'test_multiple_returns_tag'.


/**
 * test_multiple_tags:
 *
 * Since: 3.0
 * Since: 3.0
 **/

// EXPECT:139: Warning: Test: multiple 'Since:' tags for identifier 'test_multiple_tags':
//+ * Since: 3.0
//+   ^


/**
 * test_tag_annotatable:
 *
 * There's currently 2 tags that can be annotated, so these don't emit warnings
 *
 * Returns: (allow-none): something
 * Attributes: (free) (form) (annotations)
 **/

/**
 * test_tag_not_annotatable:
 *
 * Tags (except Returns: and Attributes:) don't have annotations
 *
 * Since: (allow-none): 2.24
 **/

// EXPECT:161: Warning: Test: annotations not supported for tag 'Since:'.


/**
 * test_multiline_annotations_on_parameter:
 * @param1: (allow-none)
 * (transfer full): first parameter
 *
 * Annotations spanning multiple lines are not valid
 **/

// EXPECT:170: Warning: Test: ignoring invalid multiline annotation continuation:
//+ * (transfer full): first parameter
//+   ^


/**
 * test_multiline_annotations_on_tag:
 *
 * Annotations spanning multiple lines are not valid
 *
 * Returns: (allow-none)
 * (transfer full): something
 **/

// EXPECT:186: Warning: Test: ignoring invalid multiline annotation continuation:
//+ * (transfer full): something
//+   ^


/**

 * regress_test_invalid_comment:
 * @foo: a param
 *
 * invalid comment with a line without
 * https://bugzilla.gnome.org/show_bug.cgi?id=673806
 */

// EXPECT:195: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
//+
//+^