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 703086 - Want CCode's "type" attribute to apply to fields
Want CCode's "type" attribute to apply to fields
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator
0.18.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-25 22:40 UTC by Richard Schwarting
Modified: 2018-05-22 14:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test type on fields (496 bytes, text/x-vala)
2013-06-25 22:40 UTC, Richard Schwarting
  Details
libxml-2.0.vapi patch that changes just xmlNs's href to be type = "xmlChar*" (368 bytes, patch)
2013-06-25 22:41 UTC, Richard Schwarting
none Details | Review

Description Richard Schwarting 2013-06-25 22:40:28 UTC
Created attachment 247779 [details]
test type on fields

The use case in particular is with libxml2.  It frequently uses xmlChar* instead of char* (and never gchar*) for its strings.

Right now, parametres on methods can be declared with 
foo ([CCode (type = "xmlChar*)" string arg, ...);
in libxml-2.0.vapi to have the generated C code correctly cast between xmlChar* and gchar*.  

However, we cannot currently do that with fields.  For instance, with libxml2, the xmlNs type has a field "const xmlChar *href;", but going to the .vapi and writing in the Ns class: 
[CCode (type = "xmlChar*")]
public string href;

does not result in the generated C code casting it.


NOTE:
https://wiki.gnome.org/Vala/Manual/Attributes#CCode_Attribute
This section of the documentation has previously claimed that "type" applies on fields.  I'm currently removing it, but it should probably be re-added once "type" actually does apply to fields. :)


I'm attaching a tiny test file that will generate the warnings.
Comment 1 Richard Schwarting 2013-06-25 22:41:31 UTC
Created attachment 247780 [details] [review]
libxml-2.0.vapi patch that changes just xmlNs's href to be type = "xmlChar*"

Patch just adding the type attribute to href in xmlNs in libxml-2.0.vapi, just to use with the above test file
Comment 2 GNOME Infrastructure Team 2018-05-22 14:51:03 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/vala/issues/388.