[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/19] qapi: Fix enum doc comment checking
From: |
Markus Armbruster |
Subject: |
[PATCH 09/19] qapi: Fix enum doc comment checking |
Date: |
Thu, 24 Oct 2019 13:02:27 +0200 |
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 <address@hidden>
---
scripts/qapi/schema.py | 4 ++++
tests/qapi-schema/doc-bad-enum-member.err | 1 +
tests/qapi-schema/doc-bad-enum-member.json | 1 -
tests/qapi-schema/doc-bad-enum-member.out | 21 ---------------------
4 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 9b62c8d74d..0381e3cb40 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -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'
diff --git a/tests/qapi-schema/doc-bad-enum-member.err
b/tests/qapi-schema/doc-bad-enum-member.err
index e69de29bb2..dfa1e786d7 100644
--- a/tests/qapi-schema/doc-bad-enum-member.err
+++ b/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
diff --git a/tests/qapi-schema/doc-bad-enum-member.json
b/tests/qapi-schema/doc-bad-enum-member.json
index 9f32fe64b4..9cab35c6e8 100644
--- a/tests/qapi-schema/doc-bad-enum-member.json
+++ b/tests/qapi-schema/doc-bad-enum-member.json
@@ -1,5 +1,4 @@
# Members listed in the doc comment must exist in the actual schema
-# BUG: nonexistent @a is not rejected
##
# @Foo:
diff --git a/tests/qapi-schema/doc-bad-enum-member.out
b/tests/qapi-schema/doc-bad-enum-member.out
index 6ca31c1e9b..e69de29bb2 100644
--- a/tests/qapi-schema/doc-bad-enum-member.out
+++ b/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
--
2.21.0
- [PATCH 01/19] tests/qapi-schema: Demonstrate feature and enum doc comment bugs, (continued)
- [PATCH 01/19] tests/qapi-schema: Demonstrate feature and enum doc comment bugs, Markus Armbruster, 2019/10/24
- [PATCH 13/19] qapi: Eliminate .check_doc() overrides, Markus Armbruster, 2019/10/24
- [PATCH 16/19] qapi: Fold normalize_enum() into check_enum(), Markus Armbruster, 2019/10/24
- [PATCH 12/19] qapi: Simplify ._make_implicit_object_type(), Markus Armbruster, 2019/10/24
- [PATCH 05/19] qemu-doc: Belatedly document QMP command deprecation, Markus Armbruster, 2019/10/24
- [PATCH 10/19] qapi: Clean up doc comment checking for implicit union base, Markus Armbruster, 2019/10/24
- [PATCH 08/19] qapi: Split .connect_doc(), .check_doc() off .check(), Markus Armbruster, 2019/10/24
- [PATCH 18/19] qapi: Polish reporting of bogus member documentation, Markus Armbruster, 2019/10/24
- [PATCH 04/19] tests/qapi-schema: Fix feature documentation testing, Markus Armbruster, 2019/10/24
- [PATCH 03/19] tests/qapi-schema: Cover alternate documentation comments, Markus Armbruster, 2019/10/24
- [PATCH 09/19] qapi: Fix enum doc comment checking,
Markus Armbruster <=
- [PATCH 07/19] qapi: De-duplicate entity documentation generation code, Markus Armbruster, 2019/10/24
- [PATCH 11/19] qapi: Fix doc comment checking for commands and events, Markus Armbruster, 2019/10/24
- [PATCH 15/19] qapi: Fold normalize_features() into check_features(), Markus Armbruster, 2019/10/24
- [PATCH 02/19] tests/qapi-schema: Demonstrate command and event doc comment bugs, Markus Armbruster, 2019/10/24
- [PATCH 19/19] qapi: Check feature documentation against the schema, Markus Armbruster, 2019/10/24
- [PATCH 14/19] qapi: Fold normalize_if() into check_if(), Markus Armbruster, 2019/10/24
- [PATCH 17/19] qapi: Lift features into QAPISchemaEntity, Markus Armbruster, 2019/10/24
- [PATCH 06/19] qapi: Implement boxed event argument documentation, Markus Armbruster, 2019/10/24