Skip to content

qapi: Another round of fixes and cleanups

Markus Armbruster qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest26 patches 2 repliesIn review
  2. v126 patches 16 repliesSuperseded

Changes in v2 from the cover letter

* Trivially rebased, R-bys retained
* [PATCH 02] Clean up string literal to please pylint
* [PATCH 07] Commit message fix [Eric]
* [PATCH 20] Doc fix [Eric]
* [PATCH 21] Update test cases for the change even though they fail for other reasons [Eric]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/26qapi: Clarify docs on including the same file multiple timesdocs/qapi-code-gen.txt+2 -20 replies
2/26qapi: Clean up cgen() and mcgen()scripts/qapi-commands.py scripts/qapi.py+13 -80 replies
3/26qapi: Simplify guardname()scripts/qapi.py+3 -70 replies
4/26qapi-event: Clean up how name of enum QAPIEvent is madedocs/qapi-code-gen.txt scripts/qapi-event.py tests/test-qmp-event.c+6 -60 replies
5/26qapi: Reject -p arguments that break qapi-event.pyscripts/qapi.py+6 -00 replies
6/26qapi: Drop unused and useless parameters and variablesscripts/qapi-commands.py scripts/qapi-event.py scripts/qapi-types.py +2 more+35 -420 replies
7/26qapi: Fix generated code when flat union has member 'kind'scripts/qapi-types.py scripts/qapi-visit.py tests/test-qmp-input-visitor.c +1 more+9 -50 replies
8/26qapi: Generate a nicer struct for flat unionsscripts/qapi-types.py+22 -160 replies
9/26qapi-visit: Fix generated code when schema has forward refsscripts/qapi-visit.py tests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out+36 -190 replies
10/26qapi-visit: Replace list implicit_structs by setscripts/qapi-visit.py+3 -40 replies
11/26qapi-visit: Fix two name arguments passed to visitorsscripts/qapi-visit.py+6 -60 replies
12/26tests/qapi-schema: Document alternate's enum lacks visit functiontests/qapi-schema/qapi-schema-test.json+1 -00 replies
13/26tests/qapi-schema: Document events with base don't worktests/qapi-schema/qapi-schema-test.json+3 -00 replies
14/26qapi: Document that input visitor semantics are prone to leaksscripts/qapi-visit.py tests/test-qmp-input-visitor.c+6 -00 replies
15/26qapi: Document shortcoming with union 'data' branchscripts/qapi-types.py+8 -00 replies
16/26qapi: Document flaws in checking of namesscripts/qapi.py+4 -00 replies
17/26tests/qapi-schema: Restore test case for flat union base bugtests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out+7 -60 replies
18/26tests/qapi-schema: Rename tests from data- to args-tests/Makefile tests/qapi-schema/args-array-empty.err tests/qapi-schema/args-array-empty.exit +29 more+9 -90 replies
19/26qapi-tests: New tests for union, alternate command argumentstests/Makefile tests/qapi-schema/args-alternate.err tests/qapi-schema/args-alternate.exit +6 more+16 -10 replies
20/26qapi: Fix to reject union command and event argumentsdocs/qapi-code-gen.txt scripts/qapi.py tests/qapi-schema/args-union.err +3 more+8 -120 replies
21/26qapi: Command returning anonymous type doesn't work, outlawdocs/qapi-code-gen.txt scripts/qapi.py tests/Makefile +8 more+16 -200 replies
22/26qapi-commands: Fix gen_err_check(e) for e and e != 'local_err'scripts/qapi-commands.py+7 -60 replies
23/26qapi-commands: Inline gen_marshal_output_call()scripts/qapi-commands.py+4 -80 replies
24/26qapi-commands: Don't feed output of mcgen() to mcgen() againscripts/qapi-commands.py+21 -310 replies
25/26qapi-commands: Drop useless initializationdocs/qapi-code-gen.txt scripts/qapi-commands.py+3 -70 replies
26/26qapi: Generated code cleanupdocs/qapi-code-gen.txt scripts/qapi-commands.py scripts/qapi-event.py +2 more+39 -440 replies

Reviews trailers per patch

24 of 26 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEric Blake
SeriesR-b R-b R-b R-b R-b R-b R-b
1/26R-b
2/26R-b
3/26R-b
4/26R-b
5/26R-b
6/26R-b
7/26R-b
8/26R-b
9/26R-b
10/26R-b
11/26R-b
12/26R-b
13/26R-b
14/26
15/26
16/26R-b
17/26R-b
18/26R-b
19/26R-b
20/26R-b
21/26R-b
22/26R-b
23/26R-b
24/26R-b
25/26R-b
26/26R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 00/26] qapi: Another round of fixes and cleanups

v2:
* Trivially rebased, R-bys retained
* [PATCH 02] Clean up string literal to please pylint
* [PATCH 07] Commit message fix [Eric]
* [PATCH 20] Doc fix [Eric]
* [PATCH 21] Update test cases for the change even though they fail for other reasons [Eric]

Previously posted as part of "[PATCH RFC v2 00/47] qapi: QMP introspection". Changes since then:
* Trivially rebased, R-bys retained unless noted otherwise.
* PATCH 01: Squash in update of qapi-code-gen.txt examples to current code.
* PATCH 04: Update qapi-code-gen.txt for the change.
* PATCH 05: Fix typo of --prefix in error message [Eric].
* PATCH 06: Clearer commit message [Eric].
* PATCH 07+08: Old PATCH 07 split up into bug fix and cleanup, crediting Eric for the bug report. Generate comments on member inheritance [Eric], and move generated "union tag is" comment. R-by dropped.
* PATCH 14+15: New, from Eric.
* PATCH 16+18: New.
* PATCH 19: Add note on events to commit message. Drop invalid TODO [Eric]. Straightforward conflicts with new PATCH 18 resolved.
* PATCH 20: Fix events, too [Eric]. R-by dropped.
* PATCH 21+25: New.
* PATCH 26: Restore truncated commit message [Eric]. Update qapi-code-gen.txt for the change.
* Parches not mentioned are identical.

Eric Blake (2):
qapi: Document that input visitor semantics are prone to leaks
qapi: Document shortcoming with union 'data' branch

Markus Armbruster (24):
qapi: Clarify docs on including the same file multiple times
qapi: Clean up cgen() and mcgen()
qapi: Simplify guardname()
qapi-event: Clean up how name of enum QAPIEvent is made
qapi: Reject -p arguments that break qapi-event.py
qapi: Drop unused and useless parameters and variables
qapi: Fix generated code when flat union has member 'kind'
qapi: Generate a nicer struct for flat unions
qapi-visit: Fix generated code when schema has forward refs
qapi-visit: Replace list implicit_structs by set
qapi-visit: Fix two name arguments passed to visitors tests/qapi-schema: Document alternate's enum lacks visit function tests/qapi-schema: Document events with base don't work
qapi: Document flaws in checking of names tests/qapi-schema: Restore test case for flat union base bug tests/qapi-schema: Rename tests from data- to args-
qapi-tests: New tests for union, alternate command arguments
qapi: Fix to reject union command and event arguments
qapi: Command returning anonymous type doesn't work, outlaw
qapi-commands: Fix gen_err_check(e) for e and e != 'local_err'
qapi-commands: Inline gen_marshal_output_call()
qapi-commands: Don't feed output of mcgen() to mcgen() again
qapi-commands: Drop useless initialization
qapi: Generated code cleanup

 docs/qapi-code-gen.txt                             |  48 +++++----
 scripts/qapi-commands.py                           | 109 +++++++++-----------
 scripts/qapi-event.py                              |   6 +-
 scripts/qapi-types.py                              | 110 +++++++++++----------
 scripts/qapi-visit.py                              |  93 ++++++++++-------
 scripts/qapi.py                                    |  46 +++++----
 tests/Makefile                                     |   9 +-
 tests/qapi-schema/args-alternate.err               |   1 +
 ...ted-struct-returns.exit => args-alternate.exit} |   0
 tests/qapi-schema/args-alternate.json              |   3 +
 ...ested-struct-returns.out => args-alternate.out} |   0
 .../{data-array-empty.err => args-array-empty.err} |   2 +-
 .../{data-unknown.exit => args-array-empty.exit}   |   0
 ...data-array-empty.json => args-array-empty.json} |   0
 .../{data-unknown.out => args-array-empty.out}     |   0
 ...ta-array-unknown.err => args-array-unknown.err} |   2 +-
 ...member-unknown.exit => args-array-unknown.exit} |   0
 ...-array-unknown.json => args-array-unknown.json} |   0
 ...a-member-unknown.out => args-array-unknown.out} |   0
 tests/qapi-schema/args-int.err                     |   1 +
 .../{data-member-array-bad.exit => args-int.exit}  |   0
 tests/qapi-schema/{data-int.json => args-int.json} |   0
 .../{data-member-array.err => args-int.out}        |   0
 ...ber-array-bad.err => args-member-array-bad.err} |   2 +-
 .../{data-int.exit => args-member-array-bad.exit}  |   0
 ...r-array-bad.json => args-member-array-bad.json} |   0
 ...ber-array-bad.out => args-member-array-bad.out} |   0
 .../{data-int.out => args-member-array.err}        |   0
 ...ta-member-array.exit => args-member-array.exit} |   0
 ...ta-member-array.json => args-member-array.json} |   0
 ...data-member-array.out => args-member-array.out} |   0
 tests/qapi-schema/args-member-unknown.err          |   1 +
 ...array-unknown.exit => args-member-unknown.exit} |   0
 ...ember-unknown.json => args-member-unknown.json} |   0
 ...a-array-unknown.out => args-member-unknown.out} |   0
 tests/qapi-schema/args-union.err                   |   1 +
 .../{data-array-empty.exit => args-union.exit}     |   0
 tests/qapi-schema/args-union.json                  |   4 +
 .../{data-array-empty.out => args-union.out}       |   0
 tests/qapi-schema/args-unknown.err                 |   1 +
 tests/qapi-schema/args-unknown.exit                |   1 +
 .../{data-unknown.json => args-unknown.json}       |   0
 tests/qapi-schema/args-unknown.out                 |   0
 tests/qapi-schema/command-int.json                 |   3 +-
 tests/qapi-schema/data-int.err                     |   1 -
 tests/qapi-schema/data-member-unknown.err          |   1 -
 tests/qapi-schema/data-unknown.err                 |   1 -
 tests/qapi-schema/nested-struct-data.json          |   3 +-
 tests/qapi-schema/nested-struct-returns.err        |   1 -
 tests/qapi-schema/nested-struct-returns.json       |   3 -
 tests/qapi-schema/qapi-schema-test.json            |  39 +++++---
 tests/qapi-schema/qapi-schema-test.out             |  14 +--
 tests/qapi-schema/returns-dict.err                 |   1 +
 tests/qapi-schema/returns-dict.exit                |   1 +
 tests/qapi-schema/returns-dict.json                |   2 +
 tests/qapi-schema/returns-dict.out                 |   0
 tests/test-qmp-event.c                             |   2 +-
 tests/test-qmp-input-visitor.c                     |   4 +-
 tests/test-qmp-output-visitor.c                    |   2 +-
 59 files changed, 276 insertions(+), 242 deletions(-)
 create mode 100644 tests/qapi-schema/args-alternate.err
 rename tests/qapi-schema/{nested-struct-returns.exit => args-alternate.exit} (100%)
 create mode 100644 tests/qapi-schema/args-alternate.json
 rename tests/qapi-schema/{nested-struct-returns.out => args-alternate.out} (100%)
 rename tests/qapi-schema/{data-array-empty.err => args-array-empty.err} (50%)
 rename tests/qapi-schema/{data-unknown.exit => args-array-empty.exit} (100%)
 rename tests/qapi-schema/{data-array-empty.json => args-array-empty.json} (100%)
 rename tests/qapi-schema/{data-unknown.out => args-array-empty.out} (100%)
 rename tests/qapi-schema/{data-array-unknown.err => args-array-unknown.err} (50%)
 rename tests/qapi-schema/{data-member-unknown.exit => args-array-unknown.exit} (100%)
 rename tests/qapi-schema/{data-array-unknown.json => args-array-unknown.json} (100%)
 rename tests/qapi-schema/{data-member-unknown.out => args-array-unknown.out} (100%)
 create mode 100644 tests/qapi-schema/args-int.err
 rename tests/qapi-schema/{data-member-array-bad.exit => args-int.exit} (100%)
 rename tests/qapi-schema/{data-int.json => args-int.json} (100%)
 rename tests/qapi-schema/{data-member-array.err => args-int.out} (100%)
 rename tests/qapi-schema/{data-member-array-bad.err => args-member-array-bad.err} (52%)
 rename tests/qapi-schema/{data-int.exit => args-member-array-bad.exit} (100%)
 rename tests/qapi-schema/{data-member-array-bad.json => args-member-array-bad.json} (100%)
 rename tests/qapi-schema/{data-member-array-bad.out => args-member-array-bad.out} (100%)
 rename tests/qapi-schema/{data-int.out => args-member-array.err} (100%)
 rename tests/qapi-schema/{data-member-array.exit => args-member-array.exit} (100%)
 rename tests/qapi-schema/{data-member-array.json => args-member-array.json} (100%)
 rename tests/qapi-schema/{data-member-array.out => args-member-array.out} (100%)
 create mode 100644 tests/qapi-schema/args-member-unknown.err
 rename tests/qapi-schema/{data-array-unknown.exit => args-member-unknown.exit} (100%)
 rename tests/qapi-schema/{data-member-unknown.json => args-member-unknown.json} (100%)
 rename tests/qapi-schema/{data-array-unknown.out => args-member-unknown.out} (100%)
 create mode 100644 tests/qapi-schema/args-union.err
 rename tests/qapi-schema/{data-array-empty.exit => args-union.exit} (100%)
 create mode 100644 tests/qapi-schema/args-union.json
 rename tests/qapi-schema/{data-array-empty.out => args-union.out} (100%)
 create mode 100644 tests/qapi-schema/args-unknown.err
 create mode 100644 tests/qapi-schema/args-unknown.exit
 rename tests/qapi-schema/{data-unknown.json => args-unknown.json} (100%)
 create mode 100644 tests/qapi-schema/args-unknown.out
 delete mode 100644 tests/qapi-schema/data-int.err
 delete mode 100644 tests/qapi-schema/data-member-unknown.err
 delete mode 100644 tests/qapi-schema/data-unknown.err
 delete mode 100644 tests/qapi-schema/nested-struct-returns.err
 delete mode 100644 tests/qapi-schema/nested-struct-returns.json
 create mode 100644 tests/qapi-schema/returns-dict.err
 create mode 100644 tests/qapi-schema/returns-dict.exit
 create mode 100644 tests/qapi-schema/returns-dict.json
 create mode 100644 tests/qapi-schema/returns-dict.out
Signature · 1 line
2.4.3