mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-23 05:25:11 +00:00
qapi: Support downstream flat unions
Enhance the testsuite to cover downstream flat unions, including the base type, discriminator name and type, and branch name and type. Update the generator to mangle the union names in the appropriate places. Backports commit 857af5f06c3fb097d1bb6bc8a23b9992aac99e75 from qemu
This commit is contained in:
parent
a2119bd210
commit
4292c61dbe
|
@ -204,7 +204,7 @@ struct %(name)s
|
|||
void *data;
|
||||
''',
|
||||
name=name,
|
||||
discriminator_type_name=discriminator_type_name)
|
||||
discriminator_type_name=c_name(discriminator_type_name))
|
||||
|
||||
for key in typeinfo:
|
||||
ret += mcgen('''
|
||||
|
|
|
@ -253,7 +253,7 @@ def generate_visit_union(expr):
|
|||
if enum_define:
|
||||
# Use the enum type as discriminator
|
||||
ret = ""
|
||||
disc_type = enum_define['enum_name']
|
||||
disc_type = c_name(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
|
||||
|
@ -291,7 +291,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **e
|
|||
goto out_obj;
|
||||
}
|
||||
''',
|
||||
name=name)
|
||||
name=c_name(name))
|
||||
|
||||
if not discriminator:
|
||||
disc_key = "type"
|
||||
|
|
Loading…
Reference in a new issue