Still RFC because it depends on Markus' RFC v5 (actually his qapi-introspect branch at commit 87e905b): https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01599.html
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 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 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 v4: 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. Eric Blake (27): qapi: Provide nicer array names in introspection qapi: use 'type' in generated C code to match QMP union wire form vnc: hoist allocation of VncBasicInfo to callers qapi: Unbox base members qapi-visit: Remove redundant functions for flat union base qapi: Test use of 'number' within alternates qapi: Simplify visiting of alternate types qapi: Hide tag_name data member of variants qapi: Fix alternates that accept 'number' but not 'int' qapi: Don't pass pre-existing error to later call qapi: Use consistent generated code patterns qapi: Add tests for empty unions qapi: Rework deallocation of partial struct qapi: Avoid use of 'data' member of qapi unions qapi: Forbid empty unions and useless alternates qapi: Drop useless 'data' member of unions qapi: Remove dead visitor code qapi: Document visitor interfaces qapi: Plug leaks in test-qmp-input-visitor qapi: Test failure in middle of array parse qapi: Change visit_type_FOO() to no longer return partial objects qapi: Plumb in 'box' to qapi generator lower levels qapi: Implement boxed structs for commands/events qapi: Support boxed unions qapi: Clean up qapi.py per pep8 net: Use correct type for bool flag net: Complete qapi-fication of netdev_add Kővágó, Zoltán (2): net: use Netdev instead of NetClientOptions in client init qapi: Change Netdev into a flat union block/qcow2.c | 2 +- block/vmdk.c | 2 +- blockdev.c | 34 ++-- docs/qapi-code-gen.txt | 47 +++-- hmp.c | 18 +- hw/arm/musicpal.c | 2 +- hw/core/qdev-properties-system.c | 2 +- hw/input/hid.c | 2 +- hw/input/ps2.c | 2 +- hw/input/virtio-input-hid.c | 2 +- hw/mem/pc-dimm.c | 2 +- hw/net/allwinner_emac.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/dp8393x.c | 2 +- hw/net/e1000.c | 2 +- hw/net/eepro100.c | 2 +- hw/net/etraxfs_eth.c | 2 +- hw/net/fsl_etsec/etsec.c | 2 +- hw/net/imx_fec.c | 2 +- hw/net/lan9118.c | 2 +- hw/net/lance.c | 2 +- hw/net/mcf_fec.c | 2 +- hw/net/milkymist-minimac2.c | 2 +- hw/net/mipsnet.c | 2 +- hw/net/ne2000-isa.c | 2 +- hw/net/ne2000.c | 2 +- hw/net/opencores_eth.c | 2 +- hw/net/pcnet-pci.c | 2 +- hw/net/rocker/rocker_fp.c | 2 +- hw/net/rtl8139.c | 2 +- hw/net/smc91c111.c | 2 +- hw/net/spapr_llan.c | 2 +- hw/net/stellaris_enet.c | 2 +- hw/net/vhost_net.c | 18 +- hw/net/virtio-net.c | 6 +- hw/net/vmxnet3.c | 2 +- hw/net/xen_nic.c | 2 +- hw/net/xgmac.c | 2 +- hw/net/xilinx_axienet.c | 2 +- hw/net/xilinx_ethlite.c | 2 +- hw/usb/dev-network.c | 4 +- include/net/net.h | 7 +- include/qapi/visitor-impl.h | 55 ++++-- include/qapi/visitor.h | 222 ++++++++++++++++++++++-- monitor.c | 14 +- net/clients.h | 20 +-- net/dump.c | 8 +- net/hub.c | 24 +-- net/l2tpv3.c | 8 +- net/net.c | 180 +++++++++++--------- net/netmap.c | 6 +- net/slirp.c | 8 +- net/socket.c | 10 +- net/tap-win32.c | 8 +- net/tap.c | 28 +-- net/vde.c | 8 +- net/vhost-user.c | 14 +- numa.c | 4 +- qapi-schema.json | 72 +++++--- qapi/qapi-dealloc-visitor.c | 26 --- qapi/qapi-visit-core.c | 158 +++++++---------- qapi/qmp-input-visitor.c | 8 +- qemu-char.c | 24 +-- qmp-commands.hx | 2 +- scripts/qapi-commands.py | 101 ++++++----- scripts/qapi-event.py | 75 ++++---- scripts/qapi-introspect.py | 12 +- scripts/qapi-types.py | 83 +++------ scripts/qapi-visit.py | 164 ++++++++++-------- scripts/qapi.py | 284 ++++++++++++++++++++----------- tests/Makefile | 6 +- tests/qapi-schema/alternate-empty.err | 1 + tests/qapi-schema/alternate-empty.exit | 1 + tests/qapi-schema/alternate-empty.json | 2 + tests/qapi-schema/alternate-empty.out | 0 tests/qapi-schema/alternate-good.out | 1 - tests/qapi-schema/alternate-nested.json | 2 +- tests/qapi-schema/alternate-unknown.json | 2 +- tests/qapi-schema/args-bad-box.err | 1 + tests/qapi-schema/args-bad-box.exit | 1 + tests/qapi-schema/args-bad-box.json | 2 + tests/qapi-schema/args-bad-box.out | 0 tests/qapi-schema/args-box-anon.err | 1 + tests/qapi-schema/args-box-anon.exit | 1 + tests/qapi-schema/args-box-anon.json | 2 + tests/qapi-schema/args-box-anon.out | 0 tests/qapi-schema/args-box-empty.err | 1 + tests/qapi-schema/args-box-empty.exit | 1 + tests/qapi-schema/args-box-empty.json | 2 + tests/qapi-schema/args-box-empty.out | 0 tests/qapi-schema/args-member-array.out | 2 +- tests/qapi-schema/args-union.err | 2 +- tests/qapi-schema/args-union.json | 3 +- tests/qapi-schema/event-case.out | 1 + tests/qapi-schema/flat-union-empty.err | 1 + tests/qapi-schema/flat-union-empty.exit | 1 + tests/qapi-schema/flat-union-empty.json | 4 + tests/qapi-schema/flat-union-empty.out | 0 tests/qapi-schema/ident-with-escape.out | 2 +- tests/qapi-schema/indented-expr.out | 4 +- tests/qapi-schema/qapi-schema-test.json | 15 +- tests/qapi-schema/qapi-schema-test.out | 49 ++++-- tests/qapi-schema/returns-int.out | 2 +- tests/qapi-schema/test-qapi.py | 12 +- tests/qapi-schema/union-empty.err | 1 + tests/qapi-schema/union-empty.exit | 1 + tests/qapi-schema/union-empty.json | 2 + tests/qapi-schema/union-empty.out | 0 tests/test-qmp-commands.c | 40 ++--- tests/test-qmp-event.c | 8 +- tests/test-qmp-input-visitor.c | 198 ++++++++++++++++++--- tests/test-qmp-output-visitor.c | 39 +++-- tests/test-visitor-serialization.c | 14 +- tpm.c | 2 +- ui/input-keymap.c | 10 +- ui/input-legacy.c | 2 +- ui/input.c | 24 +-- ui/spice-core.c | 23 +-- ui/vnc.c | 64 +++---- util/qemu-sockets.c | 12 +- 120 files changed, 1471 insertions(+), 924 deletions(-) create mode 100644 tests/qapi-schema/alternate-empty.err 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-bad-box.err create mode 100644 tests/qapi-schema/args-bad-box.exit create mode 100644 tests/qapi-schema/args-bad-box.json create mode 100644 tests/qapi-schema/args-bad-box.out create mode 100644 tests/qapi-schema/args-box-anon.err create mode 100644 tests/qapi-schema/args-box-anon.exit create mode 100644 tests/qapi-schema/args-box-anon.json create mode 100644 tests/qapi-schema/args-box-anon.out create mode 100644 tests/qapi-schema/args-box-empty.err create mode 100644 tests/qapi-schema/args-box-empty.exit create mode 100644 tests/qapi-schema/args-box-empty.json create mode 100644 tests/qapi-schema/args-box-empty.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/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