After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 561619 - [annotation] Support annotations of structure and union fields
[annotation] Support annotations of structure and union fields
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
2.19.x
Other Linux
: Normal enhancement
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
: 651132 (view as bug list)
Depends on: 561575
Blocks:
 
 
Reported: 2008-11-20 00:14 UTC by Andreas Rottmann
Modified: 2018-01-25 16:37 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andreas Rottmann 2008-11-20 00:14:01 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;
};
Comment 1 Andreas Rottmann 2008-11-22 04:37:24 UTC
I think for struct and union fields, the default should be allow_none = 1.
Comment 2 Johan (not receiving bugmail) Dahlin 2011-08-26 10:09:23 UTC
*** Bug 651132 has been marked as a duplicate of this bug. ***
Comment 3 Emmanuele Bassi (:ebassi) 2013-09-13 15:12:39 UTC
*** Bug 594294 has been marked as a duplicate of this bug. ***
Comment 4 André Klapper 2015-02-07 17:17:50 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 5 Garrett Regier 2015-03-15 07:03:03 UTC
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?
Comment 6 Emmanuele Bassi (:ebassi) 2018-01-25 16:37:25 UTC
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.