GNOME Bugzilla – Bug 561619
[annotation] Support annotations of structure and union fields
Last modified: 2018-01-25 16:37:25 UTC
We should add support for field annotations, something like the following: /** * AnnotationObject: * * @obj: (allow-none): A #GObject **/ struct _AnnotationObject { GObject parent_instance; GObject *obj; };
I think for struct and union fields, the default should be allow_none = 1.
*** Bug 651132 has been marked as a duplicate of this bug. ***
*** Bug 594294 has been marked as a duplicate of this bug. ***
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Annotations for struct fields is already supported: https://git.gnome.org/browse/gobject-introspection/tree/tests/scanner/regress.h#n552 However, there needs to be some extra validation. For instance in that comment block, it specifies that there is a ref_count field, however there is no such field. There are also a few annotations that don't actually make sense for fields. In the case of ownership (transfer) it is going to be very binding dependant. In PyGObject it would always set a new value and dup the value when getting it, this is required by the CPython API for things like strings. But I would assume that Vala requires explicit duping when setting/getting the field. A non-comprehensive list of ignored annotations: - transfer* - skip** - destroy** - closure** - scope* - in/out/inout* - attributes Annotations that cause a warning: - rename-to** * I can't see these applying to fields, but a warning should still be produced. ** Should these annotations be supported?
This bug is for supporting annotations, and that happened. I think each currently ignored annotation should get its own bug, so we can discuss it separately.