Hard prerequisites (for all patches to apply): Markus' qjson movement: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg00471.html
Soft prerequisites (for valgrind to be happy with all touched tests): My fix for memleak in range.h: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg02666.html My fix for memleak in json-streamer.c: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg03186.html Since v3: Address review comments (lots from Markus, a few more from others) Drop patches 8-11/18 (qjson.h remains a one-off for migration) Drop patch 12/18 (done via nicer role reversal in 26/28) Defer Infinity/NaN rejection to later Rearrange lots of patches; the clone visitor half (1-15) is simpler than the JSON visitor (16-28), if we need to subdivide the series Lots of new patches, in part implementing cleanups that make later patches simpler The churn between revisions is pretty daunting; so I suspect we'll be needing a v5 as a result. But I'm really happy with how the role reversal of qobject_to_json() turned out, as well as how the polymorphic visit_complete() and visit_free() allowed me to hide knowledge of visitor subtypes from the rest of the tree. And working on this series let me plug a couple of other bugs 001/28:[----] [--] 'qapi: Rename (one) qjson.h to qobject-json.h' 002/28:[----] [--] 'qapi: Improve use of qmp/types.h' 003/28:[down] 'qemu-img: Don't leak errors when outputting JSON' 004/28:[0043] [FC] 'qapi: Add parameter to visit_end_*' 005/28:[down] 'qapi: Add new visit_free() function' 006/28:[down] 'opts-visitor: Favor new visit_free() function' 007/28:[down] 'string-input-visitor: Favor new visit_free() function' 008/28:[down] 'qmp-input-visitor: Favor new visit_free() function' 009/28:[down] 'string-output-visitor: Favor new visit_free() function' 010/28:[down] 'qmp-output-visitor: Favor new visit_free() function' 011/28:[down] 'tests: Factor out common code in qapi output tests' 012/28:[down] 'qapi: Add new visit_complete() function' 013/28:[0312] [FC] 'qapi: Add new clone visitor' 014/28:[0043] [FC] 'sockets: Use new QAPI cloning' 015/28:[0024] [FC] 'replay: Use new QAPI cloning' 016/28:[0028] [FC] 'qapi: Factor out JSON string escaping' 017/28:[0033] [FC] 'qapi: Factor out JSON number formatting' 018/28:[down] 'qapi: Add qstring_append_printf()' 019/28:[0030] [FC] 'qapi: Use qstring_append_chr() where appropriate' 020/28:[down] 'qstring: Add qstring_consume_str()' 021/28:[down] 'qstring: Add qstring_wrap_str()' 022/28:[down] 'qobject: Consolidate qobject_to_json() calls' 023/28:[down] 'tests: Test qobject_to_json() pretty formatting' 024/28:[down] 'qapi: Add JSON output visitor' 025/28:[0081] [FC] 'qapi: Support pretty printing in JSON output visitor' 026/28:[down] 'qobject: Implement qobject_to_json() atop JSON visitor' 027/28:[down] 'qapi: Add 'any' support to JSON output' 028/28:[0068] [FC] 'qemu-img: Use new JSON output formatter' Eric Blake (28): qapi: Rename (one) qjson.h to qobject-json.h qapi: Improve use of qmp/types.h qemu-img: Don't leak errors when outputting JSON qapi: Add parameter to visit_end_* qapi: Add new visit_free() function opts-visitor: Favor new visit_free() function string-input-visitor: Favor new visit_free() function qmp-input-visitor: Favor new visit_free() function string-output-visitor: Favor new visit_free() function qmp-output-visitor: Favor new visit_free() function tests: Factor out common code in qapi output tests qapi: Add new visit_complete() function qapi: Add new clone visitor sockets: Use new QAPI cloning replay: Use new QAPI cloning qapi: Factor out JSON string escaping qapi: Factor out JSON number formatting qapi: Add qstring_append_printf() qapi: Use qstring_append_chr() where appropriate qstring: Add qstring_consume_str() qstring: Add qstring_wrap_str() qobject: Consolidate qobject_to_json() calls tests: Test qobject_to_json() pretty formatting qapi: Add JSON output visitor qapi: Support pretty printing in JSON output visitor qobject: Implement qobject_to_json() atop JSON visitor qapi: Add 'any' support to JSON output qemu-img: Use new JSON output formatter include/qapi/visitor.h | 147 +++++--- include/qapi/visitor-impl.h | 24 +- scripts/qapi-commands.py | 33 +- scripts/qapi-event.py | 12 +- scripts/qapi-types.py | 6 +- scripts/qapi-visit.py | 8 +- include/io/task.h | 2 +- include/qapi/clone-visitor.h | 39 +++ include/qapi/dealloc-visitor.h | 5 +- include/qapi/json-output-visitor.h | 29 ++ include/qapi/opts-visitor.h | 4 +- include/qapi/qmp-input-visitor.h | 6 +- include/qapi/qmp-output-visitor.h | 12 +- include/qapi/qmp/{qjson.h => qobject-json.h} | 16 +- include/qapi/qmp/qstring.h | 9 +- include/qapi/qmp/types.h | 1 - include/qapi/string-input-visitor.h | 5 +- include/qapi/string-output-visitor.h | 11 +- include/qemu/sockets.h | 4 - qapi/qapi-visit-core.c | 47 ++- balloon.c | 2 +- block.c | 7 +- block/archipelago.c | 8 +- block/crypto.c | 30 +- block/nbd.c | 2 +- block/qapi.c | 9 +- block/quorum.c | 2 +- blockdev.c | 12 +- blockjob.c | 2 +- hmp.c | 19 +- hw/acpi/core.c | 8 +- hw/core/qdev.c | 2 +- hw/misc/pvpanic.c | 2 +- hw/net/virtio-net.c | 2 +- hw/pci/pcie_aer.c | 1 + hw/ppc/spapr_drc.c | 4 +- hw/virtio/virtio-balloon.c | 4 +- io/channel-socket.c | 9 +- migration/qjson.c | 12 +- monitor.c | 18 +- net/net.c | 16 +- numa.c | 6 +- qapi/json-output-visitor.c | 211 ++++++++++++ qapi/opts-visitor.c | 37 +- qapi/qapi-clone-visitor.c | 178 ++++++++++ qapi/qapi-dealloc-visitor.c | 59 +--- qapi/qmp-dispatch.c | 1 + qapi/qmp-event.c | 2 +- qapi/qmp-input-visitor.c | 18 +- qapi/qmp-output-visitor.c | 37 +- qapi/string-input-visitor.c | 20 +- qapi/string-output-visitor.c | 29 +- qemu-char.c | 5 +- qemu-img.c | 66 ++-- qga/main.c | 7 +- qmp.c | 9 +- qobject/json-parser.c | 32 +- qobject/qjson.c | 296 ---------------- qobject/qobject-json.c | 245 +++++++++++++ qobject/qobject.c | 7 +- qobject/qstring.c | 74 +++- qom/object.c | 61 ++-- qom/object_interfaces.c | 12 +- qom/qom-qobject.c | 19 +- replay/replay-input.c | 34 +- target-s390x/kvm.c | 2 +- tests/check-qnull.c | 17 +- tests/{check-qjson.c => check-qobject-json.c} | 114 +++++-- tests/check-qstring.c | 55 ++- tests/libqtest.c | 4 +- tests/test-clone-visitor.c | 207 +++++++++++ tests/test-json-output-visitor.c | 475 ++++++++++++++++++++++++++ tests/test-opts-visitor.c | 9 +- tests/test-qmp-commands.c | 8 +- tests/test-qmp-input-strict.c | 13 +- tests/test-qmp-input-visitor.c | 15 +- tests/test-qmp-output-visitor.c | 97 ++---- tests/test-string-input-visitor.c | 22 +- tests/test-string-output-visitor.c | 99 +++--- tests/test-visitor-serialization.c | 43 +-- ui/spice-core.c | 2 +- util/qemu-sockets.c | 27 -- vl.c | 2 +- MAINTAINERS | 2 +- docs/qapi-code-gen.txt | 39 +-- qapi/Makefile.objs | 2 +- qobject/Makefile.objs | 3 +- tests/.gitignore | 4 +- tests/Makefile | 15 +- tests/qemu-iotests/043.out | 22 +- 90 files changed, 2237 insertions(+), 1117 deletions(-) create mode 100644 include/qapi/clone-visitor.h create mode 100644 include/qapi/json-output-visitor.h rename include/qapi/qmp/{qjson.h => qobject-json.h} (51%) create mode 100644 qapi/json-output-visitor.c create mode 100644 qapi/qapi-clone-visitor.c delete mode 100644 qobject/qjson.c create mode 100644 qobject/qobject-json.c rename tests/{check-qjson.c => check-qobject-json.c} (95%) create mode 100644 tests/test-clone-visitor.c create mode 100644 tests/test-json-output-visitor.c -- 2.5.5