2013-06-20

[Technology] "element annotation from state 6 is unknown"

When compiling, I dislike seeing lots of warnings when my code compiles.



While building GXml, I encounter this for most files:



  GICOMP GXml-0.3.gir 

/usr/share/gir-1.0/Gee-0.8.gir:8:51: warning: element annotation from state 6 is unknown, ignoring 

...

/usr/share/gir-1.0/Gee-0.8.gir:3383:50: warning: element annotation from state 15 is unknown, ignoring 

...

/usr/share/gir-1.0/Gee-0.8.gir:3992:1: warning: element property from state 23 is unknown, ignoring 

...

GXml-0.3.gir:10:51: warning: element annotation from state 6 is unknown, ignoring 

GXml-0.3.gir:28:1: warning: element errordomain from state 6 is unknown, ignoring


The GObject Introspection compiler apparently has an issue with some elements in .gir files.  Looking at /usr/share/gir-1.0/Gee-0.8.gir, it's in XML.  Then I looked in gobject-introspection, and at it's girparser.c file, where the warning is printed.


The property element


There I found a large conditional branching block of code, start_element_handler (), that tried to identify elements by their name and their state.  If an element starts with 'p', it checks which p-elements it could be, and one such check calls start_property (), which checks if the element name is "property" and its context's state (is it either STATE_CLASS or STATE_INTERFACE?).  The element "property" is part of the third warning above.



A quick grep of Gee-0.8.gir (grep -P "(^\t<|<property)" /usr/share/gir-1.0/Gee-0.8.gir | grep -B 1 "<property" | grep -P -v "<property") shows that the parent of every property element is a class or interface, except for one, which is a <record>, and corresponds to the line number for the warning.



Indeed, some more grepping (grep -P "(^\t<|<property)" /usr/share/gir-1.0/Gee-0.8.gir | grep -B 1 "<property" | grep -P -v "<property" | sed -r -e 's,.* name="([^"]*)".*,\1,g' | grep -v "\-\-" | while read line; do grep " $line.*{$" /usr/share/vala/vapi/gee-0.8.vapi ; done) reveals that every other structure with a property extends from GLib.Object, whereas Lazy does not.  So, while Vala allows this property on this record, the girparser doesn't expect it there.



https://live.gnome.org/Vala/Manual/Classes#Types_of_class

^ this explains the difference a little, with GObject-derived classes supporting managed properties, and Fundamental GType classes (which I think <record> corresponds to) supporting unmanaged ones.



I probably need to file a bug. :)  Solutions will be extending what the girparser expects, reducing what valac allows, or just simply avoiding using certain features (if I really want to ignore the warning badly enough).


The annotation element


Looking at girparser.c, there's no handling for "annotation" at all that I can find.



Inside the Gee-0.8.gir file, some problematic annotations are these:

<namespace name="Gee" version="0.8" c:prefix="Gee">
        <annotation key="ccode.gir-version" value="0.8"/>
        <annotation key="ccode.gir-namespace" value="Gee"/>




        ...

                <property name="equal-func" writable="1">
                        <annotation key="ccode.notify" value="false"/>
                        <type name="Gee.EqualDataFunc" c:type="GeeEqualDataFunc"/>
                </property>




I wonder how prevalent such annotations are, and what provokes them.  I'm trying to create a test case right now, so I can file a bug.



So, for my GXml warnings, the annotations are in my Attr.vala file, with this line above the namespace start:

[CCode (gir_namespace = "GXml", gir_version = "0.3")]



I'm not sure that I actually want to avoid that.


Bug filed


For now, I've file a bug, 702824.  I'm not sure what the most desirable outcome is, but perhaps annotation and properties in records could be acknowledged and not warned about.


Keine Kommentare:

Kommentar veröffentlichen

Dieses Blog durchsuchen

Labels

#Technology #GNOME gnome gxml fedora bugs linux vala google #General firefox security gsoc GUADEC android bug xml fedora 18 javascript libxml2 programming web blogger encryption fedora 17 gdom git emacs libgdata memory mozilla open source serialisation upgrade web development API Spain containers design evolution fedora 16 fedora 20 fedora 22 fedup file systems friends future glib gnome shell internet luks music performance phone photos php podman preupgrade tablet testing typescript yum #Microblog Network Manager adb apache art automation bash brno catastrophe css data loss debian debugging deja-dup disaster docker emusic errors ext4 facebook fedora 19 gee gir gitlab gitorious gmail gobject google talk google+ html libxml mail microsoft mtp mysql namespaces nautilus nextcloud owncloud picasaweb pitivi ptp python raspberry pi resizing rpm school selinux signal sms speech dispatcher systemd technology texting time management uoguelph usability video web design youtube #Tech Air Canada C Electron Element Empathy Europe GError GNOME 3 GNOME Files Go Google Play Music Grimes IRC Mac OS X Mario Kart Memento Nintendo Nintendo Switch PEAP Selenium Splatoon UI VPN Xiki accessibility advertising ai albums anaconda anonymity apple ask asus eee top automake autonomous automobiles b43 backup battery berlin bit rot broadcom browsers browsing canada canadian english cars chrome clarity comments communication compiler complaints computer computers configuration console constructive criticism cron cropping customisation dataloss dconf debug symbols design patterns desktop summit development discoverability distribution diy dnf documentation drm duplicity e-mail efficiency email english environment estate experimenting ext3 fedora 11 festival file formats firejail flac flatpak forgottotagit freedom friendship fuse galaxy nexus galton gay rights gdb german germany gimp gio gjs gnome software gnome-control-center google assistant google calendar google chrome google hangouts google reader gqe graphviz growth gtest gtg gtk gvfs gvfs metadata hard drive hard drives hardware help hp humour ide identity instagram installation instant messaging integration intel interactivity introspection jabber java java 13 jobs kernel keyboard language language servers languages law learning lenovo letsencrypt libreoffice librpm life livecd liveusb login lsp macbook maintainership mariadb mario matrix memory leaks messaging mounting mouse netflix new zealand node nodelist numix obama oci ogg oggenc oh the humanity open open standards openoffice optimisation org-mode organisation package management packagekit paint shedding parallelism pdo perl pipelight privacy productivity progress progressive web apps pumpkin pwa pyright quality recursion redhat refactoring repairs report rhythmbox sandboxes scheduling screenshots self-navigating car shell sleep smartphones software software engineering speed sql ssd synergy tabs test tests themes thesis tracker travel triumf turtles tv tweak twist typing university update usb user experience valadoc video editing volunteering vpnc waf warm wayland weather web apps website wifi wiki wireless wishes work xinput xmpp xorg xpath
Powered by Blogger.