aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2024-02-27 12:39:21 +0100
committerMarkus Armbruster <armbru@redhat.com>2024-03-04 07:12:40 +0100
commite1f684ea2e80800e74feeeaa36deed41cd3ff30f (patch)
treef4f6e405ed3b5a09b6529039784c61d40a582a85 /scripts
parentab07e96c46c757ac1a020bd1cf4c81633fc88750 (diff)
qapi: Reject "Returns" section when command doesn't return anything
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240227113921.236097-14-armbru@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/parser.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index a32b2c7e7f..d8f76060b8 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -721,7 +721,12 @@ class QAPIDoc:
self.features[feature.name].connect(feature)
def check_expr(self, expr: QAPIExpression) -> None:
- if 'command' not in expr:
+ if 'command' in expr:
+ if self.returns and 'returns' not in expr:
+ raise QAPISemError(
+ self.returns.info,
+ "'Returns' section, but command doesn't return anything")
+ else:
if self.returns:
raise QAPISemError(
self.returns.info,