unicorn/qemu
Eduardo Habkost 9d412ac4b3
qapi: Fix error handling code on alternate conflict
The conflict check added by commit c0644771 ("qapi: Reject
alternates that can't work with keyval_parse()") doesn't work
with the following declaration:

{ 'alternate': 'Alt',
'data': { 'one': 'bool',
'two': 'str' } }

It crashes with:

Traceback (most recent call last):
File "./scripts/qapi-types.py", line 295, in <module>
schema = QAPISchema(input_file)
File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 1468, in __init__
self.exprs = check_exprs(parser.exprs)
File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 958, in check_exprs
check_alternate(expr, info)
File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 830, in check_alternate
% (name, key, types_seen[qtype]))
KeyError: 'QTYPE_QSTRING'

This happens because the previously-seen conflicting member
('one') can't be found at types_seen[qtype], but at
types_seen['QTYPE_BOOL'].

Fix the bug by moving the error check to the same loop that adds
new items to types_seen, raising an exception if types_seen[qt]
is already set.

Backports commit fda72ab4510bcc680a3c4fe55997aa29589884f7 from qemu
2018-03-07 16:57:59 -05:00
..
accel
crypto
default-configs
docs
fpu
hw Include qapi/error.h exactly where needed 2018-03-07 12:26:38 -05:00
include cpu:Remove unused callbacks 2018-03-07 16:55:46 -05:00
qapi qapi: Use QNull for a more regular visit_type_null() 2018-03-07 16:50:16 -05:00
qobject qapi: Separate type QNull from QObject 2018-03-07 16:43:51 -05:00
qom
scripts qapi: Fix error handling code on alternate conflict 2018-03-07 16:57:59 -05:00
target Include qapi/error.h exactly where needed 2018-03-07 12:26:38 -05:00
tcg tcg/aarch64: Add vector operations 2018-03-07 08:07:58 -05:00
util
aarch64.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
aarch64eb.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
accel.c
arm.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
armeb.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
atomic_template.h
CODING_STYLE
configure
COPYING
COPYING.LIB
cpu-exec-common.c
cpu-exec.c
cpus.c Include qapi/error.h exactly where needed 2018-03-07 12:26:38 -05:00
cputlb.c
exec.c
gen_all_header.sh
glib_compat.c
HACKING
header_gen.py target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
ioport.c
LICENSE
m68k.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
Makefile
Makefile.objs
Makefile.target
memory.c
memory_ldst.inc.c
memory_mapping.c
mips.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
mips64.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
mips64el.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
mipsel.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
powerpc.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
qapi-schema.json
qemu-timer.c
rules.mak
softmmu_template.h
sparc.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
sparc64.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00
tcg-runtime-gvec.c tcg: Add generic vector helpers with a scalar operand 2018-03-06 16:10:09 -05:00
tcg-runtime.c
translate-all.c
translate-all.h
translate-common.c
unicorn_common.h
VERSION
vl.c Include qapi/error.h exactly where needed 2018-03-07 12:26:38 -05:00
vl.h
x86_64.h target/arm: implement SM4 instructions 2018-03-07 08:57:53 -05:00