GNOME Bugzilla – Bug 703086
Want CCode's "type" attribute to apply to fields
Last modified: 2018-05-22 14:51:03 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.
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
-- 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.