unicorn/qemu
Eric Blake 0ec9a5adaf
qapi: Guarantee NULL obj on input visitor callback error
Our existing input visitors were not very consistent on errors in a
function taking 'TYPE **obj'. These are start_struct(),
start_alternate(), type_str(), and type_any(). next_list() is
similar, but can't fail (see commit 08f9541). While all of them set
'*obj' to allocated storage on success, it was not obvious whether
'*obj' was guaranteed safe on failure, or whether it was left
uninitialized. But a future patch wants to guarantee that
visit_type_FOO() does not leak a partially-constructed obj back to
the caller; it is easier to implement this if we can reliably state
that input visitors assign '*obj' regardless of success or failure,
and that on failure *obj is NULL. Add assertions to enforce
consistency in the final setting of err vs. *obj.

The opts-visitor start_struct() doesn't set an error, but it
also was doing a weird check for 0 size; all callers pass in
non-zero size if obj is non-NULL.

The testsuite has at least one spot where we no longer need
to pre-initialize a variable prior to a visit; valgrind confirms
that the test is still fine with the cleanup.

A later patch will document the design constraint implemented
here.

Backports commit e58d695e6c3a5cfa0aa2fc91b87ade017ef28b05 from qemu
2018-02-23 14:53:23 -05:00
..
crypto
default-configs
docs
fpu fpu: silence warnings 2018-02-22 09:52:28 -05:00
hw util: move declarations out of qemu-common.h 2018-02-22 09:25:48 -05:00
include qapi: Adjust layout of FooList types 2018-02-23 14:49:06 -05:00
qapi qapi: Guarantee NULL obj on input visitor callback error 2018-02-23 14:53:23 -05:00
qobject util: move declarations out of qemu-common.h 2018-02-22 09:25:48 -05:00
qom util: move declarations out of qemu-common.h 2018-02-22 09:25:48 -05:00
scripts qapi: Adjust layout of FooList types 2018-02-23 14:49:06 -05:00
target-arm target-arm: Get rid of unused variable warnings 2018-02-23 12:43:09 -05:00
target-i386 target-i386: fix typo in xsetbv implementation 2018-02-23 14:15:35 -05:00
target-m68k include/qemu/osdep.h: Don't include qapi/error.h 2018-02-21 23:08:18 -05:00
target-mips target-mips: fix call to memset in soft reset code 2018-02-23 14:01:50 -05:00
target-sparc target-sparc: fix register corruption in ldstub if there is no write permission 2018-02-23 14:06:38 -05:00
tcg tcg: check for CONFIG_DEBUG_TCG instead of NDEBUG 2018-02-23 13:55:21 -05:00
util util: align memory allocations to 2M on AArch64 2018-02-23 13:56:59 -05:00
aarch64.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
aarch64eb.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
accel.c
arm.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
armeb.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
CODING_STYLE
configure config.status: Pass extra parameters 2018-02-22 10:12:54 -05:00
COPYING
COPYING.LIB
cpu-exec-common.c
cpu-exec.c qemu-log: dfilter-ise exec, out_asm, op and opt_op 2018-02-22 10:06:19 -05:00
cpus.c
cputlb.c cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
exec.c include/exec: Move cputlb exec.c defs out 2018-02-23 10:52:25 -05:00
gen_all_header.sh
glib_compat.c glib_compat: backport hashtable iterator interfaces 2018-02-21 13:18:44 -05:00
HACKING
header_gen.py cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
ioport.c
LICENSE
m68k.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
Makefile qapi: Turn generators' mandatory option -i into an argument 2018-02-19 15:22:27 -05:00
Makefile.objs
Makefile.target
memory_mapping.c include/qemu/osdep.h: Don't include qapi/error.h 2018-02-21 23:08:18 -05:00
memory.c include/qemu/osdep.h: Don't include qapi/error.h 2018-02-21 23:08:18 -05:00
mips64.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
mips64el.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
mips.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
mipsel.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
powerpc.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
qapi-schema.json qapi: Lazy creation of array types 2018-02-19 18:55:35 -05:00
qemu-log.c log: move qemu_log_close/qemu_log_flush from header to log.c 2018-02-22 11:13:17 -05:00
qemu-timer.c
rules.mak
softmmu_template.h
sparc64.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
sparc.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00
tcg-runtime.c
translate-all.c translate-all: add missing fold of tb_ctx into tcg_ctx 2018-02-23 13:35:42 -05:00
translate-all.h
translate-common.c
unicorn_common.h
VERSION
vl.c util: move declarations out of qemu-common.h 2018-02-22 09:25:48 -05:00
vl.h
x86_64.h cputlb: move CPU_LOOP() for tlb_reset() to exec.c 2018-02-23 10:46:31 -05:00