]> Git Repo - qemu.git/commitdiff
qapi: Fix enum doc comment checking
authorMarkus Armbruster <[email protected]>
Thu, 24 Oct 2019 11:02:27 +0000 (13:02 +0200)
committerMarkus Armbruster <[email protected]>
Tue, 29 Oct 2019 06:35:16 +0000 (07:35 +0100)
Enumeration type documentation comments are not checked, as
demonstrated by test doc-bad-enum-member.  This is because we neglect
to call self.doc.check() for enumeration types.  Messed up in
816a57cd6e "qapi: Fix detection of bogus member documentation".  Fix
it.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20191024110237[email protected]>

scripts/qapi/schema.py
tests/qapi-schema/doc-bad-enum-member.err
tests/qapi-schema/doc-bad-enum-member.json
tests/qapi-schema/doc-bad-enum-member.out

index 9b62c8d74d5666aae161d1a5022a2fc86febbf50..0381e3cb405db6a989bd20b98cabe42580883674 100644 (file)
@@ -229,6 +229,10 @@ class QAPISchemaEnumType(QAPISchemaType):
             for m in self.members:
                 self.doc.connect_member(m)
 
+    def check_doc(self):
+        if self.doc:
+            self.doc.check()
+
     def is_implicit(self):
         # See QAPISchema._make_implicit_enum_type() and ._def_predefineds()
         return self.name.endswith('Kind') or self.name == 'QType'
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..dfa1e786d7c6acf003a15de1cfe9fc10d1215009 100644 (file)
@@ -0,0 +1 @@
+doc-bad-enum-member.json:3: the following documented members are not in the declaration: a
index 9f32fe64b41c60100051bc205ca9ef4d321150d0..9cab35c6e8ec764508c8f7d038b0d2dc9908f8a9 100644 (file)
@@ -1,5 +1,4 @@
 # Members listed in the doc comment must exist in the actual schema
-# BUG: nonexistent @a is not rejected
 
 ##
 # @Foo:
index 6ca31c1e9bbd84ace4503d20f486ef12586b9881..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,21 +0,0 @@
-module None
-object q_empty
-enum QType
-    prefix QTYPE
-    member none
-    member qnull
-    member qnum
-    member qstring
-    member qdict
-    member qlist
-    member qbool
-module doc-bad-enum-member.json
-enum Foo
-    member b
-doc symbol=Foo
-    body=
-
-    arg=a
-a
-    arg=b
-b
This page took 0.032473 seconds and 4 git commands to generate.