]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Handle `doc:format` element in root:repository
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 17 Feb 2025 17:30:20 +0000 (18:30 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 17 Feb 2025 17:39:19 +0000 (18:39 +0100)
See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/448

Fixes https://gitlab.gnome.org/GNOME/vala/issues/1586

tests/Makefile.am
tests/gir/doc-format.gir [new file with mode: 0644]
tests/gir/doc-format.vapi-expected [new file with mode: 0644]
vala/valagirparser.vala

index dc493c990a4ebd2028b01a222be7579755fb3fc9..ce7f030f1a93b3094d63a76ad6b2d9e379871b38 100644 (file)
@@ -905,6 +905,7 @@ TESTS = \
        gir/delegate-closure-destroy-index-conflict.gir \
        gir/delegate-error-pos.gir \
        gir/dev_t.gir \
+       gir/doc-format.gir \
        gir/enum.gir \
        gir/errordomain.gir \
        gir/gid_t.gir \
diff --git a/tests/gir/doc-format.gir b/tests/gir/doc-format.gir
new file mode 100644 (file)
index 0000000..a8b9c33
--- /dev/null
@@ -0,0 +1,11 @@
+<?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">
+<include name="GObject" version="2.0"/>
+<include name="GLib" version="2.0"/>
+<include name="Gio" version="2.0"/>
+<package name="test"/>
+<c:include name="test.h"/>
+<doc:format name="unknown"/>
+<namespace name="Test" version="1.0" shared-library="test" c:prefix="Test" c:identifier-prefixes="Test" c:symbol-prefixes="test">
+</namespace>
+</repository>
diff --git a/tests/gir/doc-format.vapi-expected b/tests/gir/doc-format.vapi-expected
new file mode 100644 (file)
index 0000000..233d3d8
--- /dev/null
@@ -0,0 +1,3 @@
+[CCode (cprefix = "Test", gir_namespace = "Test", gir_version = "1.0", lower_case_cprefix = "test_")]
+namespace Test {
+}
index e670b0e17408edeb32b0c7c81f5bb832d729297e..7672ad5b0ef54c7bfe7323267c61f92a84146c15 100644 (file)
@@ -2103,6 +2103,9 @@ public class Vala.GirParser : CodeVisitor {
                                }
                        } else if (reader.name == "c:include") {
                                parse_c_include ();
+                       } else if (reader.name == "doc:format") {
+                               //TODO Handle this format information properly
+                               skip_element ();
                        } else {
                                // error
                                Report.error (get_current_src (), "unknown child element `%s' in `repository'", reader.name);