Pārlūkot izejas kodu

qapi: Fix enum doc comment checking

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 <armbru@redhat.com>
Message-Id: <20191024110237.30963-10-armbru@redhat.com>
Markus Armbruster 5 gadi atpakaļ
vecāks
revīzija
36a43905ff

+ 4 - 0
scripts/qapi/schema.py

@@ -229,6 +229,10 @@ def connect_doc(self):
             for m in self.members:
             for m in self.members:
                 self.doc.connect_member(m)
                 self.doc.connect_member(m)
 
 
+    def check_doc(self):
+        if self.doc:
+            self.doc.check()
+
     def is_implicit(self):
     def is_implicit(self):
         # See QAPISchema._make_implicit_enum_type() and ._def_predefineds()
         # See QAPISchema._make_implicit_enum_type() and ._def_predefineds()
         return self.name.endswith('Kind') or self.name == 'QType'
         return self.name.endswith('Kind') or self.name == 'QType'

+ 1 - 0
tests/qapi-schema/doc-bad-enum-member.err

@@ -0,0 +1 @@
+doc-bad-enum-member.json:3: the following documented members are not in the declaration: a

+ 0 - 1
tests/qapi-schema/doc-bad-enum-member.json

@@ -1,5 +1,4 @@
 # Members listed in the doc comment must exist in the actual schema
 # Members listed in the doc comment must exist in the actual schema
-# BUG: nonexistent @a is not rejected
 
 
 ##
 ##
 # @Foo:
 # @Foo:

+ 0 - 21
tests/qapi-schema/doc-bad-enum-member.out

@@ -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