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 725501 - No way to specify annotations for virtual methods
No way to specify annotations for virtual methods
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-03-02 13:27 UTC by Stef Walter
Modified: 2018-02-08 12:27 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stef Walter 2014-03-02 13:27:01 UTC
Virtual methods such as the GcrCertificate get_der_data() cannot be correctly annotated, and do not take their annotations from the accompanying accessor function either.

The function in question is here:

https://git.gnome.org/browse/gcr/tree/gcr/gcr-certificate.h#n48

The accessor is here:

https://git.gnome.org/browse/gcr/tree/gcr/gcr-certificate.c#n395

This is the <virtual-method> that's generated, with an wrong <return-value>

      <virtual-method name="get_der_data">
        <return-value transfer-ownership="none">
          <type name="guint8" c:type="const guint8*"/>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <type name="Certificate" c:type="GcrCertificate*"/>
          </instance-parameter>
          <parameter name="n_data" transfer-ownership="none">
            <type name="gsize" c:type="gsize*"/>
          </parameter>
        </parameters>
      </virtual-method>

This is the <method> that's generated, with a wrong <return-value>:

      <method name="get_der_data" c:identifier="gcr_certificate_get_der_data">
        <doc xml:space="preserve">Gets the raw DER data for an X.509 certificate.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">raw DER data of the X.509 certificate</doc>
          <array length="0" zero-terminated="0" c:type="guint8*">
            <type name="guint8" c:type="guint8"/>
          </array>
        </return-value>
        <parameters>
          <instance-parameter name="self" transfer-ownership="none">
            <doc xml:space="preserve">a #GcrCertificate</doc>
            <type name="Certificate" c:type="GcrCertificate*"/>
          </instance-parameter>
          <parameter name="n_data"
                     direction="out"
                     caller-allocates="0"
                     transfer-ownership="full">
            <doc xml:space="preserve">a pointer to a location to store the size of the resulting DER data.</doc>
            <type name="gsize" c:type="gsize*"/>
          </parameter>
        </parameters>
      </method>
Comment 1 Simon Feltman 2014-03-03 01:12:46 UTC
I thought at one point I was able to explicitly annotate vfunc, something like:

	/**
	 * GcrCertificateIface::get_der_data:
	 *
	 * Returns: (array length=n_data):
	 */
	const guchar * (*get_der_data) (GcrCertificate *self,
	                                gsize *n_data);

Or at least I thought it was working in my patch for bug 693393. In any event it seems unfortunate to have to annotate both the vfunc and accessor.
Comment 2 André Klapper 2015-02-07 17:17:11 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 3 GNOME Infrastructure Team 2018-02-08 12:27:41 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/109.