mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
ab07e96c46
commit
e1f684ea2e
|
@ -721,7 +721,12 @@ class QAPIDoc:
|
||||||
self.features[feature.name].connect(feature)
|
self.features[feature.name].connect(feature)
|
||||||
|
|
||||||
def check_expr(self, expr: QAPIExpression) -> None:
|
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:
|
if self.returns:
|
||||||
raise QAPISemError(
|
raise QAPISemError(
|
||||||
self.returns.info,
|
self.returns.info,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
doc-invalid-return2.json:5: 'Returns' section, but command doesn't return anything
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Command doesn't return anything
|
||||||
|
|
||||||
|
##
|
||||||
|
# @foo:
|
||||||
|
# Returns: blah
|
||||||
|
##
|
||||||
|
{ 'command': 'foo' }
|
|
@ -79,6 +79,7 @@ schemas = [
|
||||||
'doc-invalid-end.json',
|
'doc-invalid-end.json',
|
||||||
'doc-invalid-end2.json',
|
'doc-invalid-end2.json',
|
||||||
'doc-invalid-return.json',
|
'doc-invalid-return.json',
|
||||||
|
'doc-invalid-return2.json',
|
||||||
'doc-invalid-section.json',
|
'doc-invalid-section.json',
|
||||||
'doc-invalid-start.json',
|
'doc-invalid-start.json',
|
||||||
'doc-missing-colon.json',
|
'doc-missing-colon.json',
|
||||||
|
|
Loading…
Reference in New Issue