1 /* valausedattr.c generated by valac, the Vala compiler
2 * generated from valausedattr.vala, do not modify */
3
4 /* valaunusedattr.vala
5 *
6 * Copyright (C) 2014-2015 Jürg Billeter
7 * Copyright (C) 2014-2015 Luca Bruno
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * Author:
24 * Luca Bruno <lucabru@src.gnome.org>
25 */
26
27 #include "vala.h"
28 #include <stdlib.h>
29 #include <string.h>
30 #include <glib.h>
31 #include <valagee.h>
32 #include <glib-object.h>
33
34 #define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))
35 #define _g_free0(var) (var = (g_free (var), NULL))
36 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
37 #define _vala_iterator_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterator_unref (var), NULL)))
38
39 static gpointer vala_used_attr_parent_class = NULL;
40
41 static void vala_used_attr_check_unused_attr (ValaUsedAttr* self,
42 ValaSymbol* sym);
43 static void vala_used_attr_real_visit_namespace (ValaCodeVisitor* base,
44 ValaNamespace* ns);
45 static void vala_used_attr_real_visit_class (ValaCodeVisitor* base,
46 ValaClass* cl);
47 static void vala_used_attr_real_visit_struct (ValaCodeVisitor* base,
48 ValaStruct* st);
49 static void vala_used_attr_real_visit_interface (ValaCodeVisitor* base,
50 ValaInterface* iface);
51 static void vala_used_attr_real_visit_enum (ValaCodeVisitor* base,
52 ValaEnum* en);
53 static void vala_used_attr_real_visit_error_domain (ValaCodeVisitor* base,
54 ValaErrorDomain* ed);
55 static void vala_used_attr_real_visit_delegate (ValaCodeVisitor* base,
56 ValaDelegate* cb);
57 static void vala_used_attr_real_visit_constant (ValaCodeVisitor* base,
58 ValaConstant* c);
59 static void vala_used_attr_real_visit_field (ValaCodeVisitor* base,
60 ValaField* f);
61 static void vala_used_attr_real_visit_method (ValaCodeVisitor* base,
62 ValaMethod* m);
63 static void vala_used_attr_real_visit_creation_method (ValaCodeVisitor* base,
64 ValaCreationMethod* m);
65 static void vala_used_attr_real_visit_formal_parameter (ValaCodeVisitor* base,
66 ValaParameter* p);
67 static void vala_used_attr_real_visit_property (ValaCodeVisitor* base,
68 ValaProperty* prop);
69 static void vala_used_attr_real_visit_signal (ValaCodeVisitor* base,
70 ValaSignal* sig);
71 static void vala_used_attr_finalize (ValaCodeVisitor * obj);
72 static GType vala_used_attr_get_type_once (void);
73
74 static const gchar* VALA_USED_ATTR_valac_default_attrs[188] = {"CCode", "type_signature", "default_value", "set_value_function", "type_id", "cprefix", "cheader_filename", "marshaller_type_name", "get_value_function", "cname", "destroy_function", "lvalue_access", "has_type_id", "instance_pos", "const_cname", "take_value_function", "copy_function", "free_function", "param_spec_function", "has_target", "has_typedef", "type_cname", "ref_function", "ref_function_void", "unref_function", "type", "has_construct_function", "returns_floating_reference", "gir_namespace", "gir_version", "construct_function", "lower_case_cprefix", "simple_generics", "sentinel", "scope", "has_destroy_function", "ordering", "type_check_function", "type_get_function", "has_copy_function", "lower_case_csuffix", "ref_sink_function", "dup_function", "finish_function", "generic_type_pos", "array_length_type", "array_length", "array_length_cname", "array_length_cexpr", "array_null_terminated", "vfunc_name", "finish_vfunc_name", "finish_name", "free_function_address_of", "pos", "delegate_target", "delegate_target_cname", "array_length_pos", "delegate_target_pos", "destroy_notify_pos", "ctype", "has_new_function", "notify", "finish_instance", "use_inplace", "feature_test_macro", "default_value_on_error", "async_result_pos", "error_pos", "destroy_notify_cname", "", "Immutable", "", "SingleInstance", "", "Compact", "", "NoWrapper", "", "NoThrow", "", "DestroysInstance", "", "Flags", "", "Experimental", "", "NoReturn", "", "NoArrayLength", "", "Assert", "", "ErrorBase", "", "GenericAccessors", "", "Diagnostics", "", "NoAccessorMethod", "", "ConcreteAccessor", "", "HasEmitter", "", "ReturnsModifiedPointer", "", "Deprecated", "since", "replacement", "", "Version", "since", "replacement", "deprecated", "deprecated_since", "experimental", "experimental_until", "", "Signal", "detailed", "run", "no_recurse", "action", "no_hooks", "", "Description", "nick", "blurb", "", "IntegerType", "rank", "min", "max", "signed", "width", "", "FloatingType", "rank", "decimal", "width", "", "BooleanType", "", "SimpleType", "", "PointerType", "", "Print", "", "PrintfFormat", "", "ScanfFormat", "", "FormatArg", "", "Source", "filename", "line", "column", "", "GtkChild", "name", "internal", "", "GtkTemplate", "ui", "", "GtkCallback", "name", "", "ModuleInit", "", "DBus", "name", "no_reply", "result", "use_string_marshalling", "value", "signature", "visible", "timeout", "", "GIR", "fullname", "name", "visible", ""};
75
76 ValaUsedAttr*
vala_used_attr_construct(GType object_type)77 vala_used_attr_construct (GType object_type)
78 {
79 ValaUsedAttr* self = NULL;
80 gchar* curattr = NULL;
81 gchar* _tmp0_;
82 self = (ValaUsedAttr*) vala_code_visitor_construct (object_type);
83 _tmp0_ = g_strdup ("");
84 curattr = _tmp0_;
85 {
86 const gchar** val_collection = NULL;
87 gint val_collection_length1 = 0;
88 gint _val_collection_size_ = 0;
89 gint val_it = 0;
90 val_collection = VALA_USED_ATTR_valac_default_attrs;
91 val_collection_length1 = G_N_ELEMENTS (VALA_USED_ATTR_valac_default_attrs);
92 for (val_it = 0; val_it < val_collection_length1; val_it = val_it + 1) {
93 const gchar* val = NULL;
94 val = val_collection[val_it];
95 {
96 const gchar* _tmp1_;
97 _tmp1_ = val;
98 if (g_strcmp0 (_tmp1_, "") == 0) {
99 gchar* _tmp2_;
100 _tmp2_ = g_strdup ("");
101 _g_free0 (curattr);
102 curattr = _tmp2_;
103 } else {
104 const gchar* _tmp3_;
105 _tmp3_ = curattr;
106 if (g_strcmp0 (_tmp3_, "") == 0) {
107 const gchar* _tmp4_;
108 gchar* _tmp5_;
109 const gchar* _tmp6_;
110 _tmp4_ = val;
111 _tmp5_ = g_strdup (_tmp4_);
112 _g_free0 (curattr);
113 curattr = _tmp5_;
114 _tmp6_ = curattr;
115 vala_used_attr_mark (self, _tmp6_, NULL);
116 } else {
117 const gchar* _tmp7_;
118 const gchar* _tmp8_;
119 _tmp7_ = curattr;
120 _tmp8_ = val;
121 vala_used_attr_mark (self, _tmp7_, _tmp8_);
122 }
123 }
124 }
125 }
126 }
127 _g_free0 (curattr);
128 return self;
129 }
130
131 ValaUsedAttr*
vala_used_attr_new(void)132 vala_used_attr_new (void)
133 {
134 return vala_used_attr_construct (VALA_TYPE_USED_ATTR);
135 }
136
137 /**
138 * Mark the attribute or attribute argument as used by the compiler
139 */
140 void
vala_used_attr_mark(ValaUsedAttr * self,const gchar * attribute,const gchar * argument)141 vala_used_attr_mark (ValaUsedAttr* self,
142 const gchar* attribute,
143 const gchar* argument)
144 {
145 ValaSet* set = NULL;
146 ValaMap* _tmp0_;
147 gpointer _tmp1_;
148 ValaSet* _tmp2_;
149 g_return_if_fail (self != NULL);
150 g_return_if_fail (attribute != NULL);
151 _tmp0_ = self->marked;
152 _tmp1_ = vala_map_get (_tmp0_, attribute);
153 set = (ValaSet*) _tmp1_;
154 _tmp2_ = set;
155 if (_tmp2_ == NULL) {
156 GHashFunc _tmp3_;
157 GEqualFunc _tmp4_;
158 ValaHashSet* _tmp5_;
159 ValaMap* _tmp6_;
160 ValaSet* _tmp7_;
161 _tmp3_ = g_str_hash;
162 _tmp4_ = g_str_equal;
163 _tmp5_ = vala_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp3_, _tmp4_);
164 _vala_iterable_unref0 (set);
165 set = (ValaSet*) _tmp5_;
166 _tmp6_ = self->marked;
167 _tmp7_ = set;
168 vala_map_set (_tmp6_, attribute, _tmp7_);
169 }
170 if (argument != NULL) {
171 ValaSet* _tmp8_;
172 _tmp8_ = set;
173 vala_collection_add ((ValaCollection*) _tmp8_, argument);
174 }
175 _vala_iterable_unref0 (set);
176 }
177
178 /**
179 * Traverse the code tree and warn about unused attributes.
180 *
181 * @param context a code context
182 */
183 void
vala_used_attr_check_unused(ValaUsedAttr * self,ValaCodeContext * context)184 vala_used_attr_check_unused (ValaUsedAttr* self,
185 ValaCodeContext* context)
186 {
187 ValaNamespace* _tmp0_;
188 ValaNamespace* _tmp1_;
189 g_return_if_fail (self != NULL);
190 g_return_if_fail (context != NULL);
191 _tmp0_ = vala_code_context_get_root (context);
192 _tmp1_ = _tmp0_;
193 vala_code_node_accept ((ValaCodeNode*) _tmp1_, (ValaCodeVisitor*) self);
194 }
195
196 static void
vala_used_attr_check_unused_attr(ValaUsedAttr * self,ValaSymbol * sym)197 vala_used_attr_check_unused_attr (ValaUsedAttr* self,
198 ValaSymbol* sym)
199 {
200 gboolean _tmp0_;
201 gboolean _tmp1_;
202 g_return_if_fail (self != NULL);
203 g_return_if_fail (sym != NULL);
204 _tmp0_ = vala_symbol_get_used (sym);
205 _tmp1_ = _tmp0_;
206 if (_tmp1_) {
207 GList* _tmp2_;
208 _tmp2_ = ((ValaCodeNode*) sym)->attributes;
209 {
210 GList* attr_collection = NULL;
211 GList* attr_it = NULL;
212 attr_collection = _tmp2_;
213 for (attr_it = attr_collection; attr_it != NULL; attr_it = attr_it->next) {
214 ValaAttribute* attr = NULL;
215 attr = (ValaAttribute*) attr_it->data;
216 {
217 ValaSet* set = NULL;
218 ValaMap* _tmp3_;
219 ValaAttribute* _tmp4_;
220 const gchar* _tmp5_;
221 const gchar* _tmp6_;
222 gpointer _tmp7_;
223 ValaSet* _tmp8_;
224 _tmp3_ = self->marked;
225 _tmp4_ = attr;
226 _tmp5_ = vala_attribute_get_name (_tmp4_);
227 _tmp6_ = _tmp5_;
228 _tmp7_ = vala_map_get (_tmp3_, _tmp6_);
229 set = (ValaSet*) _tmp7_;
230 _tmp8_ = set;
231 if (_tmp8_ == NULL) {
232 ValaAttribute* _tmp9_;
233 ValaSourceReference* _tmp10_;
234 ValaSourceReference* _tmp11_;
235 ValaAttribute* _tmp12_;
236 const gchar* _tmp13_;
237 const gchar* _tmp14_;
238 gchar* _tmp15_;
239 gchar* _tmp16_;
240 _tmp9_ = attr;
241 _tmp10_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp9_);
242 _tmp11_ = _tmp10_;
243 _tmp12_ = attr;
244 _tmp13_ = vala_attribute_get_name (_tmp12_);
245 _tmp14_ = _tmp13_;
246 _tmp15_ = g_strdup_printf ("attribute `%s' never used", _tmp14_);
247 _tmp16_ = _tmp15_;
248 vala_report_warning (_tmp11_, _tmp16_);
249 _g_free0 (_tmp16_);
250 } else {
251 {
252 ValaIterator* _arg_it = NULL;
253 ValaAttribute* _tmp17_;
254 ValaMap* _tmp18_;
255 ValaMap* _tmp19_;
256 ValaSet* _tmp20_;
257 ValaSet* _tmp21_;
258 ValaIterator* _tmp22_;
259 ValaIterator* _tmp23_;
260 _tmp17_ = attr;
261 _tmp18_ = vala_attribute_get_args (_tmp17_);
262 _tmp19_ = _tmp18_;
263 _tmp20_ = vala_map_get_keys (_tmp19_);
264 _tmp21_ = _tmp20_;
265 _tmp22_ = vala_iterable_iterator ((ValaIterable*) _tmp21_);
266 _tmp23_ = _tmp22_;
267 _vala_iterable_unref0 (_tmp21_);
268 _arg_it = _tmp23_;
269 while (TRUE) {
270 ValaIterator* _tmp24_;
271 gchar* arg = NULL;
272 ValaIterator* _tmp25_;
273 gpointer _tmp26_;
274 ValaSet* _tmp27_;
275 const gchar* _tmp28_;
276 _tmp24_ = _arg_it;
277 if (!vala_iterator_next (_tmp24_)) {
278 break;
279 }
280 _tmp25_ = _arg_it;
281 _tmp26_ = vala_iterator_get (_tmp25_);
282 arg = (gchar*) _tmp26_;
283 _tmp27_ = set;
284 _tmp28_ = arg;
285 if (!vala_collection_contains ((ValaCollection*) _tmp27_, _tmp28_)) {
286 ValaAttribute* _tmp29_;
287 ValaSourceReference* _tmp30_;
288 ValaSourceReference* _tmp31_;
289 const gchar* _tmp32_;
290 gchar* _tmp33_;
291 gchar* _tmp34_;
292 _tmp29_ = attr;
293 _tmp30_ = vala_code_node_get_source_reference ((ValaCodeNode*) _tmp29_);
294 _tmp31_ = _tmp30_;
295 _tmp32_ = arg;
296 _tmp33_ = g_strdup_printf ("argument `%s' never used", _tmp32_);
297 _tmp34_ = _tmp33_;
298 vala_report_warning (_tmp31_, _tmp34_);
299 _g_free0 (_tmp34_);
300 }
301 _g_free0 (arg);
302 }
303 _vala_iterator_unref0 (_arg_it);
304 }
305 }
306 _vala_iterable_unref0 (set);
307 }
308 }
309 }
310 }
311 }
312
313 static void
vala_used_attr_real_visit_namespace(ValaCodeVisitor * base,ValaNamespace * ns)314 vala_used_attr_real_visit_namespace (ValaCodeVisitor* base,
315 ValaNamespace* ns)
316 {
317 ValaUsedAttr * self;
318 self = (ValaUsedAttr*) base;
319 g_return_if_fail (ns != NULL);
320 vala_used_attr_check_unused_attr (self, (ValaSymbol*) ns);
321 vala_code_node_accept_children ((ValaCodeNode*) ns, (ValaCodeVisitor*) self);
322 }
323
324 static void
vala_used_attr_real_visit_class(ValaCodeVisitor * base,ValaClass * cl)325 vala_used_attr_real_visit_class (ValaCodeVisitor* base,
326 ValaClass* cl)
327 {
328 ValaUsedAttr * self;
329 self = (ValaUsedAttr*) base;
330 g_return_if_fail (cl != NULL);
331 vala_used_attr_check_unused_attr (self, (ValaSymbol*) cl);
332 vala_code_node_accept_children ((ValaCodeNode*) cl, (ValaCodeVisitor*) self);
333 }
334
335 static void
vala_used_attr_real_visit_struct(ValaCodeVisitor * base,ValaStruct * st)336 vala_used_attr_real_visit_struct (ValaCodeVisitor* base,
337 ValaStruct* st)
338 {
339 ValaUsedAttr * self;
340 self = (ValaUsedAttr*) base;
341 g_return_if_fail (st != NULL);
342 vala_used_attr_check_unused_attr (self, (ValaSymbol*) st);
343 vala_code_node_accept_children ((ValaCodeNode*) st, (ValaCodeVisitor*) self);
344 }
345
346 static void
vala_used_attr_real_visit_interface(ValaCodeVisitor * base,ValaInterface * iface)347 vala_used_attr_real_visit_interface (ValaCodeVisitor* base,
348 ValaInterface* iface)
349 {
350 ValaUsedAttr * self;
351 self = (ValaUsedAttr*) base;
352 g_return_if_fail (iface != NULL);
353 vala_used_attr_check_unused_attr (self, (ValaSymbol*) iface);
354 vala_code_node_accept_children ((ValaCodeNode*) iface, (ValaCodeVisitor*) self);
355 }
356
357 static void
vala_used_attr_real_visit_enum(ValaCodeVisitor * base,ValaEnum * en)358 vala_used_attr_real_visit_enum (ValaCodeVisitor* base,
359 ValaEnum* en)
360 {
361 ValaUsedAttr * self;
362 self = (ValaUsedAttr*) base;
363 g_return_if_fail (en != NULL);
364 vala_used_attr_check_unused_attr (self, (ValaSymbol*) en);
365 vala_code_node_accept_children ((ValaCodeNode*) en, (ValaCodeVisitor*) self);
366 }
367
368 static void
vala_used_attr_real_visit_error_domain(ValaCodeVisitor * base,ValaErrorDomain * ed)369 vala_used_attr_real_visit_error_domain (ValaCodeVisitor* base,
370 ValaErrorDomain* ed)
371 {
372 ValaUsedAttr * self;
373 self = (ValaUsedAttr*) base;
374 g_return_if_fail (ed != NULL);
375 vala_used_attr_check_unused_attr (self, (ValaSymbol*) ed);
376 vala_code_node_accept_children ((ValaCodeNode*) ed, (ValaCodeVisitor*) self);
377 }
378
379 static void
vala_used_attr_real_visit_delegate(ValaCodeVisitor * base,ValaDelegate * cb)380 vala_used_attr_real_visit_delegate (ValaCodeVisitor* base,
381 ValaDelegate* cb)
382 {
383 ValaUsedAttr * self;
384 self = (ValaUsedAttr*) base;
385 g_return_if_fail (cb != NULL);
386 vala_used_attr_check_unused_attr (self, (ValaSymbol*) cb);
387 vala_code_node_accept_children ((ValaCodeNode*) cb, (ValaCodeVisitor*) self);
388 }
389
390 static void
vala_used_attr_real_visit_constant(ValaCodeVisitor * base,ValaConstant * c)391 vala_used_attr_real_visit_constant (ValaCodeVisitor* base,
392 ValaConstant* c)
393 {
394 ValaUsedAttr * self;
395 self = (ValaUsedAttr*) base;
396 g_return_if_fail (c != NULL);
397 vala_used_attr_check_unused_attr (self, (ValaSymbol*) c);
398 }
399
400 static void
vala_used_attr_real_visit_field(ValaCodeVisitor * base,ValaField * f)401 vala_used_attr_real_visit_field (ValaCodeVisitor* base,
402 ValaField* f)
403 {
404 ValaUsedAttr * self;
405 self = (ValaUsedAttr*) base;
406 g_return_if_fail (f != NULL);
407 vala_used_attr_check_unused_attr (self, (ValaSymbol*) f);
408 }
409
410 static void
vala_used_attr_real_visit_method(ValaCodeVisitor * base,ValaMethod * m)411 vala_used_attr_real_visit_method (ValaCodeVisitor* base,
412 ValaMethod* m)
413 {
414 ValaUsedAttr * self;
415 self = (ValaUsedAttr*) base;
416 g_return_if_fail (m != NULL);
417 vala_used_attr_check_unused_attr (self, (ValaSymbol*) m);
418 vala_code_node_accept_children ((ValaCodeNode*) m, (ValaCodeVisitor*) self);
419 }
420
421 static void
vala_used_attr_real_visit_creation_method(ValaCodeVisitor * base,ValaCreationMethod * m)422 vala_used_attr_real_visit_creation_method (ValaCodeVisitor* base,
423 ValaCreationMethod* m)
424 {
425 ValaUsedAttr * self;
426 self = (ValaUsedAttr*) base;
427 g_return_if_fail (m != NULL);
428 vala_used_attr_check_unused_attr (self, (ValaSymbol*) m);
429 vala_code_node_accept_children ((ValaCodeNode*) m, (ValaCodeVisitor*) self);
430 }
431
432 static void
vala_used_attr_real_visit_formal_parameter(ValaCodeVisitor * base,ValaParameter * p)433 vala_used_attr_real_visit_formal_parameter (ValaCodeVisitor* base,
434 ValaParameter* p)
435 {
436 ValaUsedAttr * self;
437 self = (ValaUsedAttr*) base;
438 g_return_if_fail (p != NULL);
439 vala_used_attr_check_unused_attr (self, (ValaSymbol*) p);
440 }
441
442 static void
vala_used_attr_real_visit_property(ValaCodeVisitor * base,ValaProperty * prop)443 vala_used_attr_real_visit_property (ValaCodeVisitor* base,
444 ValaProperty* prop)
445 {
446 ValaUsedAttr * self;
447 self = (ValaUsedAttr*) base;
448 g_return_if_fail (prop != NULL);
449 vala_used_attr_check_unused_attr (self, (ValaSymbol*) prop);
450 }
451
452 static void
vala_used_attr_real_visit_signal(ValaCodeVisitor * base,ValaSignal * sig)453 vala_used_attr_real_visit_signal (ValaCodeVisitor* base,
454 ValaSignal* sig)
455 {
456 ValaUsedAttr * self;
457 self = (ValaUsedAttr*) base;
458 g_return_if_fail (sig != NULL);
459 vala_used_attr_check_unused_attr (self, (ValaSymbol*) sig);
460 vala_code_node_accept_children ((ValaCodeNode*) sig, (ValaCodeVisitor*) self);
461 }
462
463 static void
vala_used_attr_class_init(ValaUsedAttrClass * klass,gpointer klass_data)464 vala_used_attr_class_init (ValaUsedAttrClass * klass,
465 gpointer klass_data)
466 {
467 vala_used_attr_parent_class = g_type_class_peek_parent (klass);
468 ((ValaCodeVisitorClass *) klass)->finalize = vala_used_attr_finalize;
469 ((ValaCodeVisitorClass *) klass)->visit_namespace = (void (*) (ValaCodeVisitor*, ValaNamespace*)) vala_used_attr_real_visit_namespace;
470 ((ValaCodeVisitorClass *) klass)->visit_class = (void (*) (ValaCodeVisitor*, ValaClass*)) vala_used_attr_real_visit_class;
471 ((ValaCodeVisitorClass *) klass)->visit_struct = (void (*) (ValaCodeVisitor*, ValaStruct*)) vala_used_attr_real_visit_struct;
472 ((ValaCodeVisitorClass *) klass)->visit_interface = (void (*) (ValaCodeVisitor*, ValaInterface*)) vala_used_attr_real_visit_interface;
473 ((ValaCodeVisitorClass *) klass)->visit_enum = (void (*) (ValaCodeVisitor*, ValaEnum*)) vala_used_attr_real_visit_enum;
474 ((ValaCodeVisitorClass *) klass)->visit_error_domain = (void (*) (ValaCodeVisitor*, ValaErrorDomain*)) vala_used_attr_real_visit_error_domain;
475 ((ValaCodeVisitorClass *) klass)->visit_delegate = (void (*) (ValaCodeVisitor*, ValaDelegate*)) vala_used_attr_real_visit_delegate;
476 ((ValaCodeVisitorClass *) klass)->visit_constant = (void (*) (ValaCodeVisitor*, ValaConstant*)) vala_used_attr_real_visit_constant;
477 ((ValaCodeVisitorClass *) klass)->visit_field = (void (*) (ValaCodeVisitor*, ValaField*)) vala_used_attr_real_visit_field;
478 ((ValaCodeVisitorClass *) klass)->visit_method = (void (*) (ValaCodeVisitor*, ValaMethod*)) vala_used_attr_real_visit_method;
479 ((ValaCodeVisitorClass *) klass)->visit_creation_method = (void (*) (ValaCodeVisitor*, ValaCreationMethod*)) vala_used_attr_real_visit_creation_method;
480 ((ValaCodeVisitorClass *) klass)->visit_formal_parameter = (void (*) (ValaCodeVisitor*, ValaParameter*)) vala_used_attr_real_visit_formal_parameter;
481 ((ValaCodeVisitorClass *) klass)->visit_property = (void (*) (ValaCodeVisitor*, ValaProperty*)) vala_used_attr_real_visit_property;
482 ((ValaCodeVisitorClass *) klass)->visit_signal = (void (*) (ValaCodeVisitor*, ValaSignal*)) vala_used_attr_real_visit_signal;
483 }
484
485 static void
vala_used_attr_instance_init(ValaUsedAttr * self,gpointer klass)486 vala_used_attr_instance_init (ValaUsedAttr * self,
487 gpointer klass)
488 {
489 GHashFunc _tmp0_;
490 GEqualFunc _tmp1_;
491 GEqualFunc _tmp2_;
492 ValaHashMap* _tmp3_;
493 _tmp0_ = g_str_hash;
494 _tmp1_ = g_str_equal;
495 _tmp2_ = g_direct_equal;
496 _tmp3_ = vala_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, VALA_TYPE_SET, (GBoxedCopyFunc) vala_iterable_ref, (GDestroyNotify) vala_iterable_unref, _tmp0_, _tmp1_, _tmp2_);
497 self->marked = (ValaMap*) _tmp3_;
498 }
499
500 static void
vala_used_attr_finalize(ValaCodeVisitor * obj)501 vala_used_attr_finalize (ValaCodeVisitor * obj)
502 {
503 ValaUsedAttr * self;
504 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_USED_ATTR, ValaUsedAttr);
505 _vala_map_unref0 (self->marked);
506 VALA_CODE_VISITOR_CLASS (vala_used_attr_parent_class)->finalize (obj);
507 }
508
509 /**
510 * Code visitor to warn about unused attributes
511 */
512 static GType
vala_used_attr_get_type_once(void)513 vala_used_attr_get_type_once (void)
514 {
515 static const GTypeInfo g_define_type_info = { sizeof (ValaUsedAttrClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_used_attr_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaUsedAttr), 0, (GInstanceInitFunc) vala_used_attr_instance_init, NULL };
516 GType vala_used_attr_type_id;
517 vala_used_attr_type_id = g_type_register_static (VALA_TYPE_CODE_VISITOR, "ValaUsedAttr", &g_define_type_info, 0);
518 return vala_used_attr_type_id;
519 }
520
521 GType
vala_used_attr_get_type(void)522 vala_used_attr_get_type (void)
523 {
524 static volatile gsize vala_used_attr_type_id__volatile = 0;
525 if (g_once_init_enter (&vala_used_attr_type_id__volatile)) {
526 GType vala_used_attr_type_id;
527 vala_used_attr_type_id = vala_used_attr_get_type_once ();
528 g_once_init_leave (&vala_used_attr_type_id__volatile, vala_used_attr_type_id);
529 }
530 return vala_used_attr_type_id__volatile;
531 }
532
533