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 769597 - Valac puts "annotation" tag in gir xml for unknown attribute, but g-ir-compiler does not know about it "annotation"
Valac puts "annotation" tag in gir xml for unknown attribute, but g-ir-compil...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: GObject Introspection
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
: 773178 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-08-07 03:25 UTC by Lim Jongrok
Modified: 2016-11-04 08:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix gir writer (475 bytes, patch)
2016-11-03 22:01 UTC, Andrea Del Signore
committed Details | Review

Description Lim Jongrok 2016-08-07 03:25:16 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>
Comment 1 Lim Jongrok 2016-08-07 03:28:06 UTC
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.
Comment 2 Rico Tzschichholz 2016-10-18 20:34:23 UTC
*** Bug 773178 has been marked as a duplicate of this bug. ***
Comment 3 Andrea Del Signore 2016-11-03 22:01:09 UTC
Created attachment 339081 [details] [review]
Fix gir writer

One liner patch to fix the issue
Comment 4 Rico Tzschichholz 2016-11-04 08:04:49 UTC
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=".."/>