Pending prerequisites: + Markus' "typedefs: Put them back into alphabetical order" https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg04417.html + Markus' qapi-next branch http://repo.or.cz/qemu/armbru.git/shortlog/refs/heads/qapi-next
Also available as a tag at this location: git fetch git://repo.or.cz/qemu/ericb.git qapi-cleanupv13d and will soon be part of my branch with the rest of the v5 series, at: http://repo.or.cz/qemu/ericb.git/shortlog/refs/heads/qapi v13 notes: 1-26 of v12 were taken into qapi-next. 27 and 34 are dropped, replaced by new patches for whitelisting exceptions to the lower-case member name rule. Pick up the tail end of v11 that was dropped in v12 (although 26/28 and 27/28 of v11 are merged as a single 13/14 here). backport diff (confused by rename of 1, 3, and 13) 001/14:[down] 'qobject: Simplify QObject' 002/14:[0004] [FC] 'qobject: Rename qtype_code to QType' 003/14:[down] 'qapi: Convert QType into QAPI built-in enum type' 004/14:[0001] [FC] 'qapi: Simplify visiting of alternate types' 005/14:[----] [--] 'qapi: Inline _make_implicit_tag()' 006/14:[----] [--] 'qapi: Fix alternates that accept 'number' but not 'int'' 007/14:[----] [--] 'qapi: Simplify visits of optional fields' 008/14:[----] [--] 'qapi: Shorter visits of optional fields' 009/14:[down] 'qapi: Prepare new QAPISchemaMember base class' 010/14:[down] 'qapi: Track enum values by QAPISchemaMember, not string' 011/14:[down] 'qapi: Populate info['name'] for each entity' 012/14:[down] 'qapi: Enforce (or whitelist) case conventions on qapi members' 013/14:[down] 'qapi: Move duplicate collision checks to schema check()' 014/14:[0010] [FC] 'qapi: Detect base class loops' v12 notes: https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg04033.html Delay 26-28 to a later subset, and instead add lots of new prereq patches that tackle some cleanups that make case-insensitive collision detection easier. Series is now slated for 2.6. v11 notes: https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg02563.html First half of v10 subset C has been applied, so consolidate the last half of that along with all of subset D (which was at v9) into one group. Address list reviews, in particular, add a new patch 21 that makes alternate layouts a lot nicer by making qtype_code a builtin qapi type; and new patches 18-19 that try to reduce confusion on the use of camel_to_upper() in c_enum_const(). Probably too late to get these into 2.5, in which case 17/28 will need tweaks to call out 2.6. v10 notes: https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg01249.html Split several patches, redo the middle patches from Markus to be back in the order they were first posted, some fallout change to my patches due to the nicer pattern of minimizing conditionals inside .check(), by instead calling .check_clash() as needed. Change data->err magic in tests to instead use a new helper error_free_or_abort(). Add a patch that would prevent qapi case-insensitive clashes. I am redoing my subset boundaries slightly: patches 23-27 of v9 (updating the alternate layout) will be delayed to subset D, and 2 other patches previously posted in subset D are now here (turning qapi clash checking into actual error messages), so the subject line of this cover letter is slightly different. Hopefully, we are converging on something that will be ready for a pull request, especially for the earlier patches of this subset. v9 notes: https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg00652.html https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg06999.html More patches added, and several reorganized. Lots of new patches from Markus, although not in the order originally proposed. The first 8 patches are fairly straightforward, and could probably be taken as-is. Patch 9 is a rewrite of v8 4/17, but in the opposite direction (document that no sorting is done, rather than attempting to sort), so it may need further fine-tuning. Patches 12-21 represents a fusion of Markus' and my attempts to rewrite v5 7/17 into a more-reviewable set of patches, and caused further churn later in the series. Patch 23 still uses tag_member.type == None; I ran out of time to work on Markus' idea of providing an instance of QAPISchemaBuiltinType to fill the role for 'qtype_code' without being exposed through .json files and without breaking the invariant of a valid member.type after check(), and wanted to get the rest of the series started under revew. So I may need a followup patch or even a v10 of the later half of this series after exploring that idea more. v8 notes: https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg06674.html Minor changes when rebasing to latest, improved commit messages in a few places, plus the addition of a few new patches. Markus started reviewing v7, but hadn't gotten very far. v7 notes: https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg04112.html Patches 1-3 of the previous round have moved to subset B; patch 7 is gone, and a couple of new patches are present in this round. The latest version of subset B made it much easier to reason about collision detection (namely, tag values can't collide with QMP values thanks to a named rather than anonymous union in the C type), and I like how things turned out. I suspect the hardest part of the review will be patches 5/14 and 7/14, although none of this has really had much review in any earlier versions. v6 notes: https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg01980.html Add some patches and rebase onto work on subset B. Rearrange some patches from v5 (this set includes 17-20, 23, 25-27). Backport diff gets a bit confused by one patch title changing. Not much direct review comments, although some of the changes here are updated based on comments made on other patches in the v5 series. Subset D (and more?) will come later. 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 (14): qobject: Simplify QObject qobject: Rename qtype_code to QType qapi: Convert QType into QAPI built-in enum type qapi: Simplify visiting of alternate types qapi: Inline _make_implicit_tag() qapi: Fix alternates that accept 'number' but not 'int' qapi: Simplify visits of optional fields qapi: Shorter visits of optional fields qapi: Prepare new QAPISchemaMember base class qapi: Track enum values by QAPISchemaMember, not string qapi: Populate info['name'] for each entity qapi: Enforce (or whitelist) case conventions on qapi members qapi: Move duplicate collision checks to schema check() qapi: Detect base class loops block/qapi.c | 4 +- docs/qapi-code-gen.txt | 4 +- include/hw/qdev-core.h | 2 +- include/qapi/qmp/qbool.h | 1 + include/qapi/qmp/qdict.h | 1 + include/qapi/qmp/qfloat.h | 1 + include/qapi/qmp/qint.h | 1 + include/qapi/qmp/qlist.h | 1 + include/qapi/qmp/qobject.h | 56 +++---- include/qapi/qmp/qstring.h | 1 + include/qapi/visitor-impl.h | 8 +- include/qapi/visitor.h | 19 ++- include/qemu/typedefs.h | 1 + qapi/opts-visitor.c | 2 +- qapi/qapi-visit-core.c | 10 +- qapi/qmp-input-visitor.c | 10 +- qapi/string-input-visitor.c | 3 +- qobject/Makefile.objs | 2 +- qobject/qbool.c | 11 +- qobject/qdict.c | 14 +- qobject/qfloat.c | 11 +- qobject/qint.c | 11 +- qobject/qlist.c | 11 +- qobject/qnull.c | 12 +- qobject/qobject.c | 34 ++++ qobject/qstring.c | 11 +- scripts/qapi-types.py | 47 ++---- scripts/qapi-visit.py | 31 +++- scripts/qapi.py | 179 ++++++++++----------- tests/Makefile | 6 +- tests/qapi-schema/alternate-clash.err | 2 +- tests/qapi-schema/alternate-empty.out | 3 +- tests/qapi-schema/args-member-case.err | 1 + ...union-bad-branch.exit => args-member-case.exit} | 0 tests/qapi-schema/args-member-case.json | 3 + .../{union-bad-branch.out => args-member-case.out} | 0 tests/qapi-schema/base-cycle-direct.err | 1 + tests/qapi-schema/base-cycle-direct.exit | 1 + tests/qapi-schema/base-cycle-direct.json | 2 + tests/qapi-schema/base-cycle-direct.out | 0 tests/qapi-schema/base-cycle-indirect.err | 1 + tests/qapi-schema/base-cycle-indirect.exit | 1 + tests/qapi-schema/base-cycle-indirect.json | 3 + tests/qapi-schema/base-cycle-indirect.out | 0 tests/qapi-schema/comments.out | 2 + tests/qapi-schema/empty.out | 2 + tests/qapi-schema/enum-clash-member.err | 2 +- tests/qapi-schema/enum-clash-member.json | 2 +- tests/qapi-schema/enum-member-case.err | 1 + tests/qapi-schema/enum-member-case.exit | 1 + tests/qapi-schema/enum-member-case.json | 3 + tests/qapi-schema/enum-member-case.out | 0 tests/qapi-schema/event-case.out | 2 + tests/qapi-schema/flat-union-clash-member.err | 2 +- tests/qapi-schema/flat-union-empty.out | 2 + tests/qapi-schema/ident-with-escape.out | 2 + tests/qapi-schema/include-relpath.out | 2 + tests/qapi-schema/include-repetition.out | 2 + tests/qapi-schema/include-simple.out | 2 + tests/qapi-schema/indented-expr.out | 2 + tests/qapi-schema/qapi-schema-test.out | 10 +- tests/qapi-schema/struct-base-clash-deep.err | 2 +- tests/qapi-schema/struct-base-clash.err | 2 +- tests/qapi-schema/union-bad-branch.err | 1 - tests/qapi-schema/union-bad-branch.json | 8 - tests/qapi-schema/union-branch-case.err | 1 + tests/qapi-schema/union-branch-case.exit | 1 + tests/qapi-schema/union-branch-case.json | 3 + tests/qapi-schema/union-branch-case.out | 0 tests/qapi-schema/union-clash-branches.err | 2 +- tests/qapi-schema/union-clash-branches.json | 2 +- tests/qapi-schema/union-clash-data.out | 2 + tests/qapi-schema/union-empty.out | 2 + tests/test-qmp-input-visitor.c | 29 ++-- tests/test-qmp-output-visitor.c | 4 +- 75 files changed, 315 insertions(+), 306 deletions(-) create mode 100644 qobject/qobject.c create mode 100644 tests/qapi-schema/args-member-case.err rename tests/qapi-schema/{union-bad-branch.exit => args-member-case.exit} (100%) create mode 100644 tests/qapi-schema/args-member-case.json rename tests/qapi-schema/{union-bad-branch.out => args-member-case.out} (100%) create mode 100644 tests/qapi-schema/base-cycle-direct.err create mode 100644 tests/qapi-schema/base-cycle-direct.exit create mode 100644 tests/qapi-schema/base-cycle-direct.json create mode 100644 tests/qapi-schema/base-cycle-direct.out create mode 100644 tests/qapi-schema/base-cycle-indirect.err create mode 100644 tests/qapi-schema/base-cycle-indirect.exit create mode 100644 tests/qapi-schema/base-cycle-indirect.json create mode 100644 tests/qapi-schema/base-cycle-indirect.out create mode 100644 tests/qapi-schema/enum-member-case.err create mode 100644 tests/qapi-schema/enum-member-case.exit create mode 100644 tests/qapi-schema/enum-member-case.json create mode 100644 tests/qapi-schema/enum-member-case.out delete mode 100644 tests/qapi-schema/union-bad-branch.err delete mode 100644 tests/qapi-schema/union-bad-branch.json create mode 100644 tests/qapi-schema/union-branch-case.err create mode 100644 tests/qapi-schema/union-branch-case.exit create mode 100644 tests/qapi-schema/union-branch-case.json create mode 100644 tests/qapi-schema/union-branch-case.out -- 2.4.3