diff options
author | Eric Blake | 2015-05-04 17:05:08 +0200 |
---|---|---|
committer | Markus Armbruster | 2015-05-05 18:39:00 +0200 |
commit | 44bd1276a7dea747c41f250cb71ab65965343a7f (patch) | |
tree | 894d69d943b040b621e1eff76edd5532de3e212d /tests/qapi-schema/flat-union-bad-discriminator.out | |
parent | qapi: Forbid base without discriminator in unions (diff) | |
download | qemu-44bd1276a7dea747c41f250cb71ab65965343a7f.tar.gz qemu-44bd1276a7dea747c41f250cb71ab65965343a7f.tar.xz qemu-44bd1276a7dea747c41f250cb71ab65965343a7f.zip |
qapi: Tighten checking of unions
Previous commits demonstrated that the generator had several
flaws with less-than-perfect unions:
- a simple union that listed the same branch twice (or two variant
names that map to the same C enumerator, including the implicit
MAX sentinel) ended up generating invalid C code
- an anonymous union that listed two branches with the same qtype
ended up generating invalid C code
- the generator crashed on anonymous union attempts to use an
array type
- the generator was silently ignoring a base type for anonymous
unions
- the generator allowed unknown types or nested anonymous unions
as a branch in an anonymous union
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema/flat-union-bad-discriminator.out')
-rw-r--r-- | tests/qapi-schema/flat-union-bad-discriminator.out | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/tests/qapi-schema/flat-union-bad-discriminator.out b/tests/qapi-schema/flat-union-bad-discriminator.out index b6ce2171ba..e69de29bb2 100644 --- a/tests/qapi-schema/flat-union-bad-discriminator.out +++ b/tests/qapi-schema/flat-union-bad-discriminator.out @@ -1,10 +0,0 @@ -[OrderedDict([('enum', 'TestEnum'), ('data', ['value1', 'value2'])]), - OrderedDict([('type', 'TestBase'), ('data', OrderedDict([('enum1', 'TestEnum'), ('kind', 'str')]))]), - OrderedDict([('type', 'TestTypeA'), ('data', OrderedDict([('string', 'str')]))]), - OrderedDict([('type', 'TestTypeB'), ('data', OrderedDict([('integer', 'int')]))]), - OrderedDict([('union', 'TestUnion'), ('base', 'TestBase'), ('discriminator', []), ('data', OrderedDict([('kind1', 'TestTypeA'), ('kind2', 'TestTypeB')]))])] -[{'enum_name': 'TestEnum', 'enum_values': ['value1', 'value2']}, - {'enum_name': 'TestUnionKind', 'enum_values': None}] -[OrderedDict([('type', 'TestBase'), ('data', OrderedDict([('enum1', 'TestEnum'), ('kind', 'str')]))]), - OrderedDict([('type', 'TestTypeA'), ('data', OrderedDict([('string', 'str')]))]), - OrderedDict([('type', 'TestTypeB'), ('data', OrderedDict([('integer', 'int')]))])] |