qemu-e2k/tests
Eric Blake 51e72bc1dd qapi: Swap visit_* arguments for consistent 'name' placement
JSON uses "name":value, but many of our visitor interfaces were
called with visit_type_FOO(v, &value, name, errp).  This can be
a bit confusing to have to mentally swap the parameter order to
match JSON order.  It's particularly bad for visit_start_struct(),
where the 'name' parameter is smack in the middle of the
otherwise-related group of 'obj, kind, size' parameters! It's
time to do a global swap of the parameter ordering, so that the
'name' parameter is always immediately after the Visitor argument.

Additional reason in favor of the swap: the existing include/qjson.h
prefers listing 'name' first in json_prop_*(), and I have plans to
unify that file with the qapi visitors; listing 'name' first in
qapi will minimize churn to the (admittedly few) qjson.h clients.

Later patches will then fix docs, object.h, visitor-impl.h, and
those clients to match.

Done by first patching scripts/qapi*.py by hand to make generated
files do what I want, then by running the following Coccinelle
script to affect the rest of the code base:
 $ spatch --sp-file script `git grep -l '\bvisit_' -- '**/*.[ch]'`
I then had to apply some touchups (Coccinelle insisted on TAB
indentation in visitor.h, and botched the signature of
visit_type_enum() by rewriting 'const char *const strings[]' to
the syntactically invalid 'const char*const[] strings').  The
movement of parameters is sufficient to provoke compiler errors
if any callers were missed.

    // Part 1: Swap declaration order
    @@
    type TV, TErr, TObj, T1, T2;
    identifier OBJ, ARG1, ARG2;
    @@
     void visit_start_struct
    -(TV v, TObj OBJ, T1 ARG1, const char *name, T2 ARG2, TErr errp)
    +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
     { ... }

    @@
    type bool, TV, T1;
    identifier ARG1;
    @@
     bool visit_optional
    -(TV v, T1 ARG1, const char *name)
    +(TV v, const char *name, T1 ARG1)
     { ... }

    @@
    type TV, TErr, TObj, T1;
    identifier OBJ, ARG1;
    @@
     void visit_get_next_type
    -(TV v, TObj OBJ, T1 ARG1, const char *name, TErr errp)
    +(TV v, const char *name, TObj OBJ, T1 ARG1, TErr errp)
     { ... }

    @@
    type TV, TErr, TObj, T1, T2;
    identifier OBJ, ARG1, ARG2;
    @@
     void visit_type_enum
    -(TV v, TObj OBJ, T1 ARG1, T2 ARG2, const char *name, TErr errp)
    +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
     { ... }

    @@
    type TV, TErr, TObj;
    identifier OBJ;
    identifier VISIT_TYPE =~ "^visit_type_";
    @@
     void VISIT_TYPE
    -(TV v, TObj OBJ, const char *name, TErr errp)
    +(TV v, const char *name, TObj OBJ, TErr errp)
     { ... }

    // Part 2: swap caller order
    @@
    expression V, NAME, OBJ, ARG1, ARG2, ERR;
    identifier VISIT_TYPE =~ "^visit_type_";
    @@
    (
    -visit_start_struct(V, OBJ, ARG1, NAME, ARG2, ERR)
    +visit_start_struct(V, NAME, OBJ, ARG1, ARG2, ERR)
    |
    -visit_optional(V, ARG1, NAME)
    +visit_optional(V, NAME, ARG1)
    |
    -visit_get_next_type(V, OBJ, ARG1, NAME, ERR)
    +visit_get_next_type(V, NAME, OBJ, ARG1, ERR)
    |
    -visit_type_enum(V, OBJ, ARG1, ARG2, NAME, ERR)
    +visit_type_enum(V, NAME, OBJ, ARG1, ARG2, ERR)
    |
    -VISIT_TYPE(V, OBJ, NAME, ERR)
    +VISIT_TYPE(V, NAME, OBJ, ERR)
    )

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1454075341-13658-19-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-02-08 17:29:56 +01:00
..
acpi-test-data tests: pc: acpi: add expected DSDT.bridge blobs and update DSDT blobs 2016-02-04 19:53:02 +02:00
guest-debug tests/guest-debug: introduce basic gdbstub tests 2015-12-17 13:37:15 +00:00
image-fuzzer tests: Use Python 2.6 "except E as ..." syntax 2016-02-08 17:29:54 +01:00
libqos libqos: remove some leaks 2016-02-02 13:28:58 +01:00
multiboot
qapi-schema qapi: Detect base class loops 2015-12-17 08:21:29 +01:00
qemu-iotests tests: Use Python 2.6 "except E as ..." syntax 2016-02-08 17:29:54 +01:00
rocker
tcg
vmstate-static-checker-data
.gitignore crypto: add QCryptoSecret object class for password/key handling 2015-12-18 16:25:08 +00:00
ac97-test.c
ahci-test.c ide: Clean up includes 2016-01-29 15:07:23 +00:00
bios-tables-test.c tests: acpi: print ASL diff in verbose mode 2016-01-08 16:01:37 +02:00
boot-order-test.c
check-block.sh qemu-iotests: make check-block.sh work on out-of-tree builds 2016-01-07 21:30:16 +01:00
check-qdict.c
check-qfloat.c
check-qint.c
check-qjson.c check-qjson: Add test for JSON nesting depth limit 2015-11-26 09:18:38 +01:00
check-qlist.c
check-qom-interface.c
check-qom-proplist.c qom: Change object property iterator API contract 2016-01-18 17:47:58 +01:00
check-qstring.c
crypto-tls-x509-helpers.c crypto: fix leaks in TLS x509 helper functions 2015-11-18 14:56:58 +00:00
crypto-tls-x509-helpers.h
device-introspect-test.c qdev: Protect device-list-properties against broken devices 2015-10-09 15:25:57 +02:00
display-vga-test.c
drive_del-test.c libqtest: New hmp() & friends 2015-10-09 15:25:57 +02:00
ds1338-test.c arm: imx25-pdk: Fix machine name 2015-10-16 11:14:53 +01:00
e1000-test.c
eepro100-test.c
endianness-test.c
es1370-test.c
fdc-test.c Revert "hw/block/fdc: Implement tray status" 2016-02-02 17:47:04 +01:00
fw_cfg-test.c Implement fw_cfg DMA interface 2015-10-19 15:26:53 +02:00
hd-geo-test.c blockdev: Set 'format' indicates non-empty drive 2015-12-18 14:34:43 +01:00
i440fx-test.c tests/i44fx-test: No need for zeroing memory before memset 2015-11-06 15:42:38 +03:00
i82801b11-test.c
ide-test.c ide: Clean up includes 2016-01-29 15:07:23 +00:00
intel-hda-test.c
io-channel-helpers.c io: add QIOChannelSocket class 2015-12-18 12:18:31 +00:00
io-channel-helpers.h io: add QIOChannelSocket class 2015-12-18 12:18:31 +00:00
ioh3420-test.c
ipmi-bt-test.c ipmi: Add tests 2015-12-22 18:39:19 +02:00
ipmi-kcs-test.c ipmi: Add tests 2015-12-22 18:39:19 +02:00
ipoctal232-test.c
ivshmem-test.c ivshmem-test: test both msi & irq cases 2016-02-02 13:28:58 +01:00
libqtest.c tests: Use proper functions types instead of void (*fn) 2015-12-04 18:25:42 +01:00
libqtest.h tests: Use proper functions types instead of void (*fn) 2015-12-04 18:25:42 +01:00
m48t59-test.c
Makefile char: convert from GIOChannel to QIOChannel 2016-01-26 15:58:11 +01:00
ne2000-test.c
nvme-test.c
pc-cpu-test.c
pcnet-test.c
pkix_asn1_tab.c
pvpanic-test.c
q35-test.c
qemu-iotests-quick.sh
qom-test.c qom-test: Fix qmp() leaks 2015-12-04 18:29:31 +01:00
rcutorture.c
rtc-test.c
rtl8139-test.c
spapr-phb-test.c
tco-test.c
test-aio.c error: Use error_reportf_err() where it makes obvious sense 2016-01-13 15:16:17 +01:00
test-base64.c util: add base64 decoding function 2015-12-18 16:25:08 +00:00
test-bitops.c
test-blockjob-txn.c tests: add BlockJobTxn unit test 2015-11-12 16:22:44 +01:00
test-coroutine.c coroutine: move into libqemuutil.a library 2015-10-20 14:59:04 +01:00
test-crypto-cipher.c crypto: add additional query accessors for cipher instances 2015-12-23 11:02:20 +00:00
test-crypto-hash.c crypto: add ability to query hash digest len 2015-12-23 11:02:20 +00:00
test-crypto-secret.c crypto: add QCryptoSecret object class for password/key handling 2015-12-18 16:25:08 +00:00
test-crypto-tlscredsx509.c
test-crypto-tlssession.c
test-cutils.c
test-hbitmap.c
test-int128.c
test-io-channel-buffer.c io: add QIOChannelBuffer class 2015-12-18 12:18:31 +00:00
test-io-channel-command.c io: add QIOChannelCommand class 2015-12-18 12:18:31 +00:00
test-io-channel-file.c io: add QIOChannelFile class 2015-12-18 12:18:31 +00:00
test-io-channel-socket.c io: fix stack allocation when sending of file descriptors 2015-12-23 10:53:03 +00:00
test-io-channel-tls.c io: add QIOChannelTLS class 2015-12-18 12:18:31 +00:00
test-io-task.c io: add QIOTask class for async operations 2015-12-18 12:18:30 +00:00
test-iov.c
test-mul64.c
test-netfilter.c tests: add test cases for netfilter object 2015-10-12 13:34:32 +08:00
test-opts-visitor.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-qdev-global-props.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-qemu-opts.c
test-qga.c qga: Better mapping of SEEK_* in guest-file-seek 2015-11-25 17:56:45 -06:00
test-qmp-commands.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-qmp-event.c qapi: Unbox base members 2015-11-02 08:30:26 +01:00
test-qmp-input-strict.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-qmp-input-visitor.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-qmp-output-visitor.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-rcu-list.c
test-rfifolock.c
test-string-input-visitor.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-string-output-visitor.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-thread-pool.c error: Use error_reportf_err() where it makes obvious sense 2016-01-13 15:16:17 +01:00
test-throttle.c test-throttle: Simplify qemu_init_main_loop() error handling 2016-01-13 15:16:17 +01:00
test-timed-average.c util: Infrastructure for computing recent averages 2015-11-12 16:22:45 +01:00
test-visitor-serialization.c qapi: Swap visit_* arguments for consistent 'name' placement 2016-02-08 17:29:56 +01:00
test-vmstate.c coroutine: move into libqemuutil.a library 2015-10-20 14:59:04 +01:00
test-write-threshold.c
test-x86-cpuid.c
test-xbzrle.c
tmp105-test.c
tpci200-test.c
usb-hcd-ehci-test.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
usb-hcd-ohci-test.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
usb-hcd-uhci-test.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
usb-hcd-xhci-test.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
vhost-user-bridge.c tests/vhost-user-bridge.c: fix fd leakage 2015-12-02 19:27:26 +02:00
vhost-user-test.c vhost-user-test: use correct ROM to speed up and avoid spurious failures 2016-02-06 20:44:08 +02:00
virtio-9p-test.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
virtio-balloon-test.c
virtio-blk-test.c
virtio-console-test.c
virtio-net-test.c
virtio-rng-test.c
virtio-scsi-test.c
virtio-serial-test.c
vmxnet3-test.c
wdt_ib700-test.c