Patch 17 is marked RFC because it has a prerequisite: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01277.html Patch 18 is marked RFC because it is probably worth discarding. Otherwise, this series addresses the review comments on v6.
Also available as a tag at this location: git fetch git://repo.or.cz/qemu/ericb.git qapi-cleanupv7a and I plan forcefully update my branch with the rest of the v5 series at some point, located at: http://repo.or.cz/qemu/ericb.git/shortlog/refs/heads/qapi v7 notes: The most churn compared to the last spin was questions over commit messages and testsuite comments in 5/16, and to an over-reaching commit 15/16 (now split, with patch 18 as the half of the split that we will probably drop). Patch 12 no longer tries gnu-style label indentation. Other patches had minor tweaks to commit messages or fixing rebase issues. More details in per-patch messages; and here's the backport diff: 001/18:[----] [--] 'qapi: Sort qapi-schema tests' 002/18:[----] [--] 'qapi: Improve 'include' error message' 003/18:[----] [--] 'qapi: Invoke exception superclass initializer' 004/18:[0004] [FC] 'qapi: Clean up qapi.py per pep8' 005/18:[0090] [FC] 'qapi: Test for various name collisions' 006/18:[0018] [FC] 'qapi: Avoid assertion failure on union 'type' collision' 007/18:[----] [-C] 'qapi: Add tests for empty unions' 008/18:[----] [--] 'qapi: Test use of 'number' within alternates' 009/18:[0008] [FC] 'qapi: Reuse code for flat union base validation' 010/18:[----] [--] 'qapi: Consistent generated code: prefer error 'err'' 011/18:[----] [--] 'qapi: Consistent generated code: prefer visitor 'v'' 012/18:[0026] [FC] 'qapi: Consistent generated code: prefer common labels' 013/18:[0004] [FC] 'qapi: Consistent generated code: prefer common indentation' 014/18:[----] [-C] 'qapi: Consistent generated code: minimize push_indent() usage' 015/18:[0074] [FC] 'qapi: Share gen_err_check()' 016/18:[----] [-C] 'qapi: Share gen_visit_fields()' 017/18:[down] 'qapi: Simplify gen_visit_fields() error handling' 018/18:[down] 'RFC: qapi: Use gen_err_check() in more places' In v6: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg07208.html This is patches 1-6 and 8-10 of my v5 series; patch 7 had enough comments that I'm still reworking it and sank it later into that series. It is 16 patches because I split several patches, and added a couple more, in part because review on v5 let me discover a place where we can crash the qapi code generator with an assert. Addresses lots of review comments, mainly from Markus; see individual patches for more details. Subset B (and more?) will come later as Markus continues to review either the rest of my v5 series, or as I get a chance to post a rebased version of them. In v5: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg05410.html I _did_ rearrange patches to try and group related features: 1-2: Groundwork cleanups 3-5: Add more test cases 6-16: Front-end cleanups 17-18: Introspection output cleanups 19-20: 'alternate' type cleanups 21-29: qapi visitor cleanups 30-45: qapi-ify netdev_add 46: add qapi shorthand for flat unions Lots of fixes based on additional testing, and rebased to track other changes that happened in the meantime. The series is huge; I can split off smaller portions as requested. In v4: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg02580.html add some more clean up patches rebase to Markus' recent work pull in part of Zoltán's work to make netdev_add a flat union, further enhancing it to be introspectible I might be able to rearrange some of these patches, or separate it into smaller independent series, if requested; but I'm posting now to get review started. In v3: https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg02059.html redo cleanup of dealloc of partial struct add patches to make all visit_type_*() avoid leaks on failure add patches to allow boxed command arguments and events In v2: https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg00900.html rebase to Markus' v3 series rework how comments are emitted for fields inherited from base additional patches added for deleting colliding 'void *data' documentation updates to match code changes v1 was here: https://lists.gnu.org/archive/html/qemu-devel/2015-07/msg05266.html https://lists.gnu.org/archive/html/qemu-devel/2015-07/msg05325.html Eric Blake (18): qapi: Sort qapi-schema tests qapi: Improve 'include' error message qapi: Invoke exception superclass initializer qapi: Clean up qapi.py per pep8 qapi: Test for various name collisions qapi: Avoid assertion failure on union 'type' collision qapi: Add tests for empty unions qapi: Test use of 'number' within alternates qapi: Reuse code for flat union base validation qapi: Consistent generated code: prefer error 'err' qapi: Consistent generated code: prefer visitor 'v' qapi: Consistent generated code: prefer common labels qapi: Consistent generated code: prefer common indentation qapi: Consistent generated code: minimize push_indent() usage qapi: Share gen_err_check() qapi: Share gen_visit_fields() qapi: Simplify gen_visit_fields() error handling qapi: Use gen_err_check() in more places docs/qapi-code-gen.txt | 102 ++++----- qom/object.c | 18 +- qom/qom-qobject.c | 18 +- scripts/ordereddict.py | 3 +- scripts/qapi-commands.py | 120 ++++------- scripts/qapi-event.py | 54 +---- scripts/qapi-types.py | 8 +- scripts/qapi-visit.py | 174 +++++++-------- scripts/qapi.py | 237 +++++++++++++++------ tests/Makefile | 171 +++++++++++---- tests/qapi-schema/alternate-clash.err | 2 +- tests/qapi-schema/alternate-clash.json | 9 +- ...-union-branch-clash.out => alternate-empty.err} | 0 tests/qapi-schema/alternate-empty.exit | 1 + tests/qapi-schema/alternate-empty.json | 2 + tests/qapi-schema/alternate-empty.out | 4 + tests/qapi-schema/alternate-nested.json | 2 +- tests/qapi-schema/alternate-unknown.json | 2 +- tests/qapi-schema/args-name-clash.err | 0 tests/qapi-schema/args-name-clash.exit | 1 + tests/qapi-schema/args-name-clash.json | 5 + tests/qapi-schema/args-name-clash.out | 6 + tests/qapi-schema/duplicate-key.err | 2 +- tests/qapi-schema/duplicate-key.json | 1 + tests/qapi-schema/flat-union-bad-base.err | 2 +- tests/qapi-schema/flat-union-base-any.err | 2 +- tests/qapi-schema/flat-union-base-union.err | 2 +- tests/qapi-schema/flat-union-base-union.json | 5 +- tests/qapi-schema/flat-union-branch-clash.err | 1 - tests/qapi-schema/flat-union-clash-branch.err | 0 tests/qapi-schema/flat-union-clash-branch.exit | 1 + tests/qapi-schema/flat-union-clash-branch.json | 18 ++ tests/qapi-schema/flat-union-clash-branch.out | 14 ++ tests/qapi-schema/flat-union-clash-member.err | 1 + ...nch-clash.exit => flat-union-clash-member.exit} | 0 ...nch-clash.json => flat-union-clash-member.json} | 2 +- tests/qapi-schema/flat-union-clash-member.out | 0 tests/qapi-schema/flat-union-clash-type.err | 1 + tests/qapi-schema/flat-union-clash-type.exit | 1 + tests/qapi-schema/flat-union-clash-type.json | 14 ++ tests/qapi-schema/flat-union-clash-type.out | 0 tests/qapi-schema/flat-union-cycle.err | 1 + tests/qapi-schema/flat-union-cycle.exit | 1 + tests/qapi-schema/flat-union-cycle.json | 8 + tests/qapi-schema/flat-union-cycle.out | 0 tests/qapi-schema/flat-union-empty.err | 0 tests/qapi-schema/flat-union-empty.exit | 1 + tests/qapi-schema/flat-union-empty.json | 4 + tests/qapi-schema/flat-union-empty.out | 7 + tests/qapi-schema/flat-union-inline.err | 2 +- tests/qapi-schema/flat-union-inline.json | 4 +- tests/qapi-schema/flat-union-no-base.err | 2 +- tests/qapi-schema/include-non-file.err | 2 +- tests/qapi-schema/include-non-file.json | 2 +- tests/qapi-schema/qapi-schema-test.json | 15 +- tests/qapi-schema/qapi-schema-test.out | 26 +++ tests/qapi-schema/struct-base-clash-base.err | 0 tests/qapi-schema/struct-base-clash-base.exit | 1 + tests/qapi-schema/struct-base-clash-base.json | 9 + tests/qapi-schema/struct-base-clash-base.out | 5 + tests/qapi-schema/struct-base-clash-deep.err | 2 +- tests/qapi-schema/struct-base-clash-deep.json | 5 +- tests/qapi-schema/struct-base-clash.err | 2 +- tests/qapi-schema/struct-base-clash.json | 3 +- tests/qapi-schema/union-clash-branches.err | 1 + tests/qapi-schema/union-clash-branches.exit | 1 + tests/qapi-schema/union-clash-branches.json | 5 + tests/qapi-schema/union-clash-branches.out | 0 tests/qapi-schema/union-clash-data.err | 0 tests/qapi-schema/union-clash-data.exit | 1 + tests/qapi-schema/union-clash-data.json | 7 + tests/qapi-schema/union-clash-data.out | 6 + tests/qapi-schema/union-clash-type.err | 1 + tests/qapi-schema/union-clash-type.exit | 1 + tests/qapi-schema/union-clash-type.json | 8 + tests/qapi-schema/union-clash-type.out | 0 tests/qapi-schema/union-empty.err | 0 tests/qapi-schema/union-empty.exit | 1 + tests/qapi-schema/union-empty.json | 2 + tests/qapi-schema/union-empty.out | 3 + tests/qapi-schema/union-invalid-base.err | 2 +- tests/test-qmp-input-visitor.c | 129 ++++++++++- 82 files changed, 837 insertions(+), 439 deletions(-) rename tests/qapi-schema/{flat-union-branch-clash.out => alternate-empty.err} (100%) create mode 100644 tests/qapi-schema/alternate-empty.exit create mode 100644 tests/qapi-schema/alternate-empty.json create mode 100644 tests/qapi-schema/alternate-empty.out create mode 100644 tests/qapi-schema/args-name-clash.err create mode 100644 tests/qapi-schema/args-name-clash.exit create mode 100644 tests/qapi-schema/args-name-clash.json create mode 100644 tests/qapi-schema/args-name-clash.out delete mode 100644 tests/qapi-schema/flat-union-branch-clash.err create mode 100644 tests/qapi-schema/flat-union-clash-branch.err create mode 100644 tests/qapi-schema/flat-union-clash-branch.exit create mode 100644 tests/qapi-schema/flat-union-clash-branch.json create mode 100644 tests/qapi-schema/flat-union-clash-branch.out create mode 100644 tests/qapi-schema/flat-union-clash-member.err rename tests/qapi-schema/{flat-union-branch-clash.exit => flat-union-clash-member.exit} (100%) rename tests/qapi-schema/{flat-union-branch-clash.json => flat-union-clash-member.json} (85%) create mode 100644 tests/qapi-schema/flat-union-clash-member.out create mode 100644 tests/qapi-schema/flat-union-clash-type.err create mode 100644 tests/qapi-schema/flat-union-clash-type.exit create mode 100644 tests/qapi-schema/flat-union-clash-type.json create mode 100644 tests/qapi-schema/flat-union-clash-type.out create mode 100644 tests/qapi-schema/flat-union-cycle.err create mode 100644 tests/qapi-schema/flat-union-cycle.exit create mode 100644 tests/qapi-schema/flat-union-cycle.json create mode 100644 tests/qapi-schema/flat-union-cycle.out create mode 100644 tests/qapi-schema/flat-union-empty.err create mode 100644 tests/qapi-schema/flat-union-empty.exit create mode 100644 tests/qapi-schema/flat-union-empty.json create mode 100644 tests/qapi-schema/flat-union-empty.out create mode 100644 tests/qapi-schema/struct-base-clash-base.err create mode 100644 tests/qapi-schema/struct-base-clash-base.exit create mode 100644 tests/qapi-schema/struct-base-clash-base.json create mode 100644 tests/qapi-schema/struct-base-clash-base.out create mode 100644 tests/qapi-schema/union-clash-branches.err create mode 100644 tests/qapi-schema/union-clash-branches.exit create mode 100644 tests/qapi-schema/union-clash-branches.json create mode 100644 tests/qapi-schema/union-clash-branches.out create mode 100644 tests/qapi-schema/union-clash-data.err create mode 100644 tests/qapi-schema/union-clash-data.exit create mode 100644 tests/qapi-schema/union-clash-data.json create mode 100644 tests/qapi-schema/union-clash-data.out create mode 100644 tests/qapi-schema/union-clash-type.err create mode 100644 tests/qapi-schema/union-clash-type.exit create mode 100644 tests/qapi-schema/union-clash-type.json create mode 100644 tests/qapi-schema/union-clash-type.out create mode 100644 tests/qapi-schema/union-empty.err create mode 100644 tests/qapi-schema/union-empty.exit create mode 100644 tests/qapi-schema/union-empty.json create mode 100644 tests/qapi-schema/union-empty.out -- 2.4.3