unicorn/qemu/scripts
Eric Blake c09db972fe
qapi: Avoid assertion failure on union 'type' collision
The previous commit added two tests that triggered an assertion
failure. It's fairly straightforward to avoid the failure by
just outright forbidding the collision between a union's tag
values and its discriminator name (including the implicit name
'kind' supplied for simple unions [*]). Ultimately, we'd like
to move the collision detection into QAPISchema*.check(), but
for now it is easier just to enhance the existing checks.

[*] Of course, down the road, we have plans to rename the simple
union tag name to 'type' to match the QMP wire name, but the
idea of the collision will still be present even then.

Technically, we could avoid the collision by naming the C union
members representing each enum value as '_case_value' rather
than 'value'; but until we have an actual qapi client (and not
just our testsuite) that has a legitimate reason to match a
case label to the name of a QMP key and needs the name munging
to satisfy the compiler, it's easier to just reject the qapi
as invalid.

Backports commit 7b2a5c2f9a52c4a08630fa741052f03fe5d3cc8a from qemu
2018-02-19 18:09:13 -05:00
..
create_config more cleanup qemu/configure 2017-01-19 14:11:54 +08:00
make_device_config.sh fix file perms 2015-08-28 21:05:38 -07:00
ordereddict.py import 2015-08-21 15:04:50 +08:00
qapi-event.py qapi-event: Convert to QAPISchemaVisitor, fixing data with base 2018-02-19 17:16:31 -05:00
qapi-types.py qapi: Introduce a first class 'any' type 2018-02-19 17:46:58 -05:00
qapi-visit.py qapi-visit: Rearrange code a bit 2018-02-19 17:37:09 -05:00
qapi.py qapi: Avoid assertion failure on union 'type' collision 2018-02-19 18:09:13 -05:00