]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
qapi: Improve error position for bogus argument descriptions
authorMarkus Armbruster <armbru@redhat.com>
Fri, 16 Feb 2024 14:58:29 +0000 (15:58 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 26 Feb 2024 09:43:56 +0000 (10:43 +0100)
When documented arguments don't exist, the error message points to the
beginning of the definition comment.  Point to the first bogus
argument description instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240216145841.2099240-6-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
scripts/qapi/parser.py
tests/qapi-schema/doc-bad-alternate-member.err
tests/qapi-schema/doc-bad-boxed-command-arg.err
tests/qapi-schema/doc-bad-command-arg.err
tests/qapi-schema/doc-bad-enum-member.err
tests/qapi-schema/doc-bad-event-arg.err
tests/qapi-schema/doc-bad-feature.err
tests/qapi-schema/doc-bad-union-member.err

index 88221b3c6408898b3df40b04c35ca4479ef02732..82db595dcfe26aa126d7191ad47bec9c3927aad9 100644 (file)
@@ -472,6 +472,8 @@ class QAPIDoc:
         # pylint: disable=too-few-public-methods
         def __init__(self, parser: QAPISchemaParser,
                      name: Optional[str] = None):
+            # section source info, i.e. where it begins
+            self.info = parser.info
             # parser, for error messages about indentation
             self._parser = parser
             # optional section name (argument/member or section name)
@@ -770,7 +772,7 @@ class QAPIDoc:
                      if not section.member]
             if bogus:
                 raise QAPISemError(
-                    self.info,
+                    args[bogus[0]].info,
                     "documented %s%s '%s' %s not exist" % (
                         what,
                         "s" if len(bogus) > 1 else "",
index d7286bb57c4005fed171fe54f19aa9cd688e5968..1f6b7d2fe40d5301eec11b0ee9b2d48532516bda 100644 (file)
@@ -1 +1 @@
-doc-bad-alternate-member.json:3: documented members 'aa', 'bb' do not exist
+doc-bad-alternate-member.json:7: documented members 'aa', 'bb' do not exist
index 7137af3ec921bacf324b35dd8e78ca440b2d55c8..d6793e7fd845748848a5583e1f905006c570c5a2 100644 (file)
@@ -1 +1 @@
-doc-bad-boxed-command-arg.json:9: documented member 'a' does not exist
+doc-bad-boxed-command-arg.json:11: documented member 'a' does not exist
index 18ed076cef6cf62cc7ca3c1a737ce70a5f9fb125..b76167ec60be3e264c22a9dd7869e55ac247d456 100644 (file)
@@ -1 +1 @@
-doc-bad-command-arg.json:3: documented member 'b' does not exist
+doc-bad-command-arg.json:6: documented member 'b' does not exist
index 7efeb4736358de50b5510e53376f21d3ba183046..0aa8d8e8e20d65a9cf7bd8438b728f3f2cb88006 100644 (file)
@@ -1 +1 @@
-doc-bad-enum-member.json:3: documented member 'a' does not exist
+doc-bad-enum-member.json:5: documented member 'a' does not exist
index d13cacf21f0c5ea28b326594b4304fabd7b39ac1..90527d5f8270d71e8e75acbdd3b770fd92d1c5b0 100644 (file)
@@ -1 +1 @@
-doc-bad-event-arg.json:3: documented member 'a' does not exist
+doc-bad-event-arg.json:5: documented member 'a' does not exist
index 49d1746c3d18a81600ba8e4a82570197a4c33af8..3166c6a305a7cfb18c513f88ad8215c018a7c13d 100644 (file)
@@ -1 +1 @@
-doc-bad-feature.json:3: documented feature 'a' does not exist
+doc-bad-feature.json:7: documented feature 'a' does not exist
index 6dd2726a65655b7f77ea9a60012c0a16d58b569b..cdf1225cab3c28409245b25c98dcef88a209f027 100644 (file)
@@ -1 +1 @@
-doc-bad-union-member.json:3: documented members 'a', 'b' do not exist
+doc-bad-union-member.json:5: documented members 'a', 'b' do not exist