qemu-patch-raspberry4/scripts
Eric Blake 82ca8e4696 qapi: Share gen_visit_fields()
Consolidate the code between visit, command marshalling, and
event generation that iterates over the members of a struct.
It reduces code duplication in the generator, so that a future
patch can reduce the size of generated code while touching only
one instead of three locations.

There are no changes to the generated marshal code.

The visitor code becomes slightly more verbose, but remains
semantically equivalent, and is actually easier to read as
it follows a more common idiom:

|     visit_optional(v, &(*obj)->has_device, "device", &err);
|-    if (!err && (*obj)->has_device) {
|-        visit_type_str(v, &(*obj)->device, "device", &err);
|-    }
|     if (err) {
|         goto out;
|     }
|+    if ((*obj)->has_device) {
|+        visit_type_str(v, &(*obj)->device, "device", &err);
|+        if (err) {
|+            goto out;
|+        }
|+    }

The event code becomes slightly more verbose, but this is
arguably a bug fix: although the visitors are not well
documented, use of an optional member should not be attempted
unless guarded by a prior call to visit_optional().  Works only
because the output qmp visitor has a no-op visit_optional():

|+    visit_optional(v, &has_offset, "offset", &err);
|+    if (err) {
|+        goto out;
|+    }
|     if (has_offset) {
|         visit_type_int(v, &offset, "offset", &err);

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-17-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-10-12 18:46:50 +02:00
..
kvm kvm_stat: add kvm_stat.1 man page 2015-03-10 10:49:25 +01:00
qemu-guest-agent qemu-ga: sample fsfreeze hooks 2013-01-08 16:38:12 -06:00
qemugdb scripts/qemu-gdb: Split CoroutineCommand into its own file 2015-09-11 17:14:49 +01:00
qmp qmp-shell: add documentation 2015-09-04 13:18:04 +02:00
tracetool trace: add DTrace reserved words for .d files 2015-03-02 15:39:43 -06:00
acpi_extract.py i386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive. 2014-11-02 11:52:24 +02:00
acpi_extract_preprocess.py i386: add ACPI table files from seabios 2013-10-14 17:48:51 +03:00
analyse-9p-simpletrace.py scripts/analyse-9p-simpletrace.py: Add symbolic names for 9p operations. 2011-12-21 12:37:23 +05:30
analyze-migration.py Teach analyze-migration.py about section footers 2015-06-12 06:54:01 +02:00
check-qerror.sh qerror: add check-qerror.sh to verify alphabetical order 2012-01-18 10:23:39 -02:00
checkpatch.pl checkpatch: do not recommend qemu_strtok over strtok 2015-09-25 12:04:41 +02:00
cleanup-trace-events.pl cleanup-trace-events.pl: Tighten search for trace event call 2014-09-26 09:34:38 +01:00
cocci-macro-file.h add macro file for coccinelle 2015-09-09 15:34:55 +02:00
coverity-model.c coverity: fix address_space_rw model 2015-05-05 10:42:11 +02:00
create_config module: implement module loading 2014-02-20 13:14:18 +01:00
disas-objdump.pl disas-objdump: Pass --adjust-vma to objdump 2013-08-24 07:26:45 +02:00
dump-guest-memory.py scripts/dump-guest-memory.py: fix after RAMBlock change 2015-09-09 15:34:55 +02:00
extract-vsssdk-headers Add a script to extract VSS SDK headers on POSIX system 2013-09-09 14:17:56 -05:00
feature_to_c.sh exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
get_maintainer.pl get_maintainer.pl: \C is deprecated 2015-09-25 12:04:41 +02:00
gtester-cat test makefile overhaul 2012-03-30 08:14:11 -05:00
hxtool vl.c: In qemu -h output, only print options for the arch we are running as 2011-12-19 10:27:33 -06:00
make-release make-release: Record SeaBIOS version 2014-03-31 15:02:04 +01:00
make_device_config.sh build: pass .d file name to scripts/make_device_config.sh, fix makefile target 2015-03-18 12:07:25 +01:00
ordereddict.py qapi: Clean up qapi.py per pep8 2015-10-12 18:44:54 +02:00
qapi-commands.py qapi: Share gen_visit_fields() 2015-10-12 18:46:50 +02:00
qapi-event.py qapi: Share gen_visit_fields() 2015-10-12 18:46:50 +02:00
qapi-introspect.py qapi-introspect: Hide type names 2015-09-21 09:56:49 +02:00
qapi-types.py qapi: Consistent generated code: prefer visitor 'v' 2015-10-12 18:46:49 +02:00
qapi-visit.py qapi: Share gen_visit_fields() 2015-10-12 18:46:50 +02:00
qapi.py qapi: Share gen_visit_fields() 2015-10-12 18:46:50 +02:00
qemu-binfmt-conf.sh scripts/qemu-binfmt-conf.sh: Add AArch64 registration 2014-03-17 16:31:53 +00:00
qemu-gdb.py scripts/qemu-gdb: Add brief comment describing usage 2015-09-11 17:14:50 +01:00
qtest.py qtest: Add scripts/qtest.py 2015-02-16 15:07:18 +00:00
refresh-pxe-roms.sh roms: rewrite scripts/refresh-pxe-roms.sh 2013-09-30 09:44:35 +02:00
shaderinclude.pl opengl: add shader build infrastructure 2015-05-05 09:03:32 +02:00
signrom.py signrom: Rewrite as python script 2012-04-16 15:41:20 +02:00
simpletrace.py simpletrace: add simpletrace.py --no-header option 2014-08-12 14:26:11 +01:00
switch-timer-api misc: Fix case Qemu -> QEMU 2014-02-15 16:10:25 +04:00
texi2pod.pl Support utf8 chars in pod docs 2012-03-24 14:10:25 +00:00
tracetool.py trace: Multi-backend tracing 2014-06-09 15:43:40 +02:00
update-acpi.sh acpi: add rules to compile ASL source 2013-10-14 17:48:51 +03:00
update-linux-headers.sh update-linux-headers: Rename SW_MAX to SW_MAX_ 2015-10-09 15:22:39 +02:00
vmstate-static-checker.py vmstate-static-checker: update whitelist 2015-02-05 17:16:14 +01:00