qemu-patch-raspberry4/include
Eric Blake 15c2f669e3 qapi: Split visit_end_struct() into pieces
As mentioned in previous patches, we want to call visit_end_struct()
functions unconditionally, so that visitors can release resources
tied up since the matching visit_start_struct() without also having
to worry about error priority if more than one error occurs.

Even though error_propagate() can be safely used to ignore a second
error during cleanup caused by a first error, it is simpler if the
cleanup cannot set an error.  So, split out the error checking
portion (basically, input visitors checking for unvisited keys) into
a new function visit_check_struct(), which can be safely skipped if
any earlier errors are encountered, and leave the cleanup portion
(which never fails, but must be called unconditionally if
visit_start_struct() succeeded) in visit_end_struct().

Generated code in qapi-visit.c has diffs resembling:

|@@ -59,10 +59,12 @@ void visit_type_ACPIOSTInfo(Visitor *v,
|         goto out_obj;
|     }
|     visit_type_ACPIOSTInfo_members(v, obj, &err);
|-    error_propagate(errp, err);
|-    err = NULL;
|+    if (err) {
|+        goto out_obj;
|+    }
|+    visit_check_struct(v, &err);
| out_obj:
|-    visit_end_struct(v, &err);
|+    visit_end_struct(v);
| out:

and in qapi-event.c:

@@ -47,7 +47,10 @@ void qapi_event_send_acpi_device_ost(ACP
|         goto out;
|     }
|     visit_type_q_obj_ACPI_DEVICE_OST_arg_members(v, &param, &err);
|-    visit_end_struct(v, err ? NULL : &err);
|+    if (!err) {
|+        visit_check_struct(v, &err);
|+    }
|+    visit_end_struct(v);
|     if (err) {
|         goto out;

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1461879932-9020-20-git-send-email-eblake@redhat.com>
[Conflict with a doc fixup resolved]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-05-12 09:47:55 +02:00
..
block block: Fix bdrv_drain in coroutine 2016-04-11 16:59:09 +01:00
crypto include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h 2016-03-22 22:20:16 +01:00
disas disas: Add print_insn to disassemble info 2015-07-09 15:20:40 +02:00
exec qemu-log: dfilter-ise exec, out_asm, op and opt_op 2016-03-22 22:20:18 +01:00
fpu include: Clean up includes 2016-02-23 12:43:05 +00:00
hw virtio-input: support absolute axis config in pass-through 2016-04-13 17:26:12 +02:00
io io: implement socket watch for win32 using WSAEventSelect+select 2016-03-10 17:19:07 +00:00
libdecnumber include: Clean up includes 2016-02-23 12:43:05 +00:00
migration migration (ordinary): move bdrv_invalidate_cache_all of of coroutine context 2016-02-26 20:39:50 +05:30
monitor Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
net Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
qapi qapi: Split visit_end_struct() into pieces 2016-05-12 09:47:55 +02:00
qemu event-notifier: Add "is_external" parameter 2016-04-22 16:43:56 +02:00
qom qom: -object error messages lost location, restore it 2016-04-28 08:19:36 +02:00
standard-headers update Linux headers to 4.6 2016-04-05 11:46:52 +02:00
sysemu kvm: add kvm_device_supported() helper function 2016-03-30 17:27:24 +01:00
ui ui/virtio-gpu: add and use qemu_create_displaysurface_pixman 2016-04-11 12:32:01 +02:00
elf.h include: Clean up includes 2016-02-23 12:43:05 +00:00
glib-compat.h glib: add compatibility interface for g_hash_table_add() 2015-10-30 09:01:03 +01:00
qemu-common.h util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
qemu-io.h qemu-io: Use BlockBackend 2015-02-16 15:07:19 +00:00
qjson.h QJSON: Add JSON writer 2015-02-05 17:16:14 +01:00
trace-tcg.h trace: [tcg] Generate TCG tracing routines 2014-08-12 14:26:12 +01:00
trace.h trace: [tcg] Include event definitions in "trace.h" 2014-08-12 14:26:12 +01:00