Want CCode's "type" attribute to apply to fields
Submitted by Richard Schwarting
Link to original bug (#703086)
Description
Created attachment 247779 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.
Attachment 247779, "test type on fields":
test.vala
Version: 0.18.x