]> git.ipfire.org Git - thirdparty/qemu.git/commit
qapi: Fix undocumented return values by generating something
authorJohn Snow <jsnow@redhat.com>
Fri, 11 Jul 2025 05:10:43 +0000 (01:10 -0400)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 14 Jul 2025 10:03:03 +0000 (12:03 +0200)
commit636c96cd77d39aaec3e1c09b9990b76b015566e1
treed9008de87470cb7b6c6bf66aee766ff5370c916e
parent2e51072ae5c0275733be748fbee3ce59df6d6261
qapi: Fix undocumented return values by generating something

Generated command documentation lacks information on return value in
several cases, e.g. query-tpm.

The obvious fix would be to require a Returns: section when a command
returns something.

However, note that many existing Returns: sections are pretty useless:
the description is basically the return type, which then gets rendered
like "Return: <Type> – <basically the return type>".  This suggests
that a description is often not really necessary, and requiring one
isn't useful.

Instead, generate the obvious minimal thing when Returns: is absent:
"Return: <Type>".

This auto-generated Return documentation is placed is as follows:

1. If we have arguments, return goes right after them.
2. Else if we have errors, return goes right before them.
3. Else if we have features, return goes right before them.
4. Else return goes right after the intro

To facilitate this algorithm, a "TODO:" hack line is used to separate
the intro from the remainder of the documentation block in cases where
there are no other sections to separate the intro from e.g. examples and
additional detail meant to appear below the key sections of interest.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250711051045.51110-3-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[_insert_near_kind() code replaced by something simpler, commit
message amended to explain why we're doing this]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
docs/sphinx/qapidoc.py
qapi/machine.json
scripts/qapi/parser.py
scripts/qapi/schema.py