summaryrefslogtreecommitdiffstats
path: root/scripts/qapi/parser.py
diff options
context:
space:
mode:
authorMarkus Armbruster2019-10-24 13:02:37 +0200
committerMarkus Armbruster2019-10-29 07:35:16 +0100
commite151941d1b691402f7914750e025209b7839a1c0 (patch)
tree038d26df94d19bcc8f9598f4cc061b8742b4ed6c /scripts/qapi/parser.py
parentqapi: Polish reporting of bogus member documentation (diff)
downloadqemu-e151941d1b691402f7914750e025209b7839a1c0.tar.gz
qemu-e151941d1b691402f7914750e025209b7839a1c0.tar.xz
qemu-e151941d1b691402f7914750e025209b7839a1c0.zip
qapi: Check feature documentation against the schema
Commit f3ed93d545 "qapi: Allow documentation for features" neglected to check documentation against the schema. Fix that: check them the same way we check arguments. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-20-armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/parser.py')
-rw-r--r--scripts/qapi/parser.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 6c45a00cf4..342792e410 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -555,18 +555,31 @@ class QAPIDoc(object):
self.args[member.name] = QAPIDoc.ArgSection(member.name)
self.args[member.name].connect(member)
+ def connect_feature(self, feature):
+ if feature.name not in self.features:
+ raise QAPISemError(feature.info,
+ "feature '%s' lacks documentation"
+ % feature.name)
+ self.features[feature.name] = QAPIDoc.ArgSection(feature.name)
+ self.features[feature.name].connect(feature)
+
def check_expr(self, expr):
if self.has_section('Returns') and 'command' not in expr:
raise QAPISemError(self.info,
"'Returns:' is only valid for commands")
def check(self):
- bogus = [name for name, section in self.args.items()
- if not section.member]
- if bogus:
- raise QAPISemError(
- self.info,
- "documented member%s '%s' %s not exist"
- % ("s" if len(bogus) > 1 else "",
- "', '".join(bogus),
- "do" if len(bogus) > 1 else "does"))
+
+ def check_args_section(args, info, what):
+ bogus = [name for name, section in args.items()
+ if not section.member]
+ if bogus:
+ raise QAPISemError(
+ self.info,
+ "documented member%s '%s' %s not exist"
+ % ("s" if len(bogus) > 1 else "",
+ "', '".join(bogus),
+ "do" if len(bogus) > 1 else "does"))
+
+ check_args_section(self.args, self.info, 'members')
+ check_args_section(self.features, self.info, 'features')