mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 06:43:53 -06:00
qapi: Support downstream simple unions
Enhance the testsuite to cover downstream simple unions, including when a union branch is a downstream name. Update the generator to mangle the union names in the appropriate places. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
83a02706bb
commit
bb33729043
4 changed files with 10 additions and 7 deletions
|
@ -255,9 +255,9 @@ def generate_visit_union(expr):
|
|||
disc_type = enum_define['enum_name']
|
||||
else:
|
||||
# There will always be a discriminator in the C switch code, by default
|
||||
# it is an enum type generated silently as "'%sKind' % (name)"
|
||||
ret = generate_visit_enum('%sKind' % name, members.keys())
|
||||
disc_type = '%sKind' % (name)
|
||||
# it is an enum type generated silently
|
||||
ret = generate_visit_enum(name + 'Kind', members.keys())
|
||||
disc_type = c_name(name) + 'Kind'
|
||||
|
||||
if base:
|
||||
assert discriminator
|
||||
|
@ -281,7 +281,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **e
|
|||
}
|
||||
if (*obj) {
|
||||
''',
|
||||
name=name)
|
||||
name=c_name(name))
|
||||
|
||||
if base:
|
||||
ret += mcgen('''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue