GNOME Bugzilla – Bug 769597
Valac puts "annotation" tag in gir xml for unknown attribute, but g-ir-compiler does not know about it "annotation"
Last modified: 2016-11-04 08:04:53 UTC
I don't know whether is supported feature or just as a fallback, but valac puts annotation tag when generating GIR file from vala files. But when g-ir-compiler read the GIR file, it does not know about "annotation" tag. It seems that it expects "attribute" tag instead of it. I tried generating gir from c source file with a free-form attribute. some-vala.vala > namespace SomeVala { > [Bar (baz="true")] > public static void foo () { > // Just do nothing > } > } SomeVala-0.0.gir from "valac some-vala.vala --gir=SomeVala-0.0.gir --library=somevala -C" > <?xml version="1.0"?> > <repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0" xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0"> > <package name="somevala"/> > <c:include name="some-vala.h"/> > <namespace name="SomeVala" version="0.0" c:prefix="SomeVala"> > <function name="foo" c:identifier="some_vala_foo"> > <annotation key="bar.baz" value="true"/> > <return-value transfer-ownership="full"> > <type name="none"/> > </return-value> > </function> > </namespace> > </repository> some-c.c > #include "some-c.h" > > /** > * some_c_foo: (attributes bar.baz=1) > */ > void some_c_foo (void) { > /* Just do nothing */ > } some-c.h > #ifndef _SOME_FOO_H > #define _SOME_FOO_H > > void some_c_foo (void); > > #endif SomeC-0.0.gir from "g-ir-scanner --library=some-c --no-libtool some-c.[ch] -o SomeC-0.0.gir --namespace=SomeC --nsversion=0.0" > <?xml version="1.0"?> > <!-- This file was automatically generated from C sources - DO NOT EDIT! > To affect the contents of this file, edit the original C definitions, > and/or use gtk-doc annotations. --> > <repository version="1.2" > xmlns="http://www.gtk.org/introspection/core/1.0" > xmlns:c="http://www.gtk.org/introspection/c/1.0" > xmlns:glib="http://www.gtk.org/introspection/glib/1.0"> > <namespace name="SomeC" > version="0.0" > shared-library="libsome-c.so" > c:identifier-prefixes="SomeC" > c:symbol-prefixes="some_c"> > <function name="foo" c:identifier="some_c_foo"> > <attribute name="bar.baz" value="true"/> > <return-value transfer-ownership="none"> > <type name="none" c:type="void"/> > </return-value> > </function> > </namespace> > </repository>
In some-c.c not (attributes bar.baz=1) but (attributes bar.baz=true) I changed the file but I missed appling the change. Sorry.
*** Bug 773178 has been marked as a duplicate of this bug. ***
Created attachment 339081 [details] [review] Fix gir writer One liner patch to fix the issue
commit 7bb9b1c691bbe175d3e2ddee4bcc1146d8ae2c4c Author: Andrea Del Signore <sejerpz@gmail.com> Date: Thu Nov 3 23:01:00 2016 +0100 girwriter: Use the correct tag- and element-name for an annotation The correct syntax is <attribute name=".." value=".."/>