qapi: Support downstream alternates

Enhance the testsuite to cover downstream alternates, including
whether the branch name or type is downstream. Update the
generator to mangle alternate names in the appropriate places.

Backports commit d1f07c86c05706facf950b0b0dba370f71fd5ef6 from qemu
This commit is contained in:
Eric Blake 2018-02-19 15:09:04 -05:00 committed by Lioncash
parent 4292c61dbe
commit 2dcd6722fa
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 8 additions and 19 deletions

View file

@ -203,11 +203,11 @@ void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **e
}
switch ((*obj)->kind) {
''',
name=name)
name=c_name(name))
# For alternate, always use the default enum type automatically generated
# as "'%sKind' % (name)"
disc_type = '%sKind' % (name)
# as name + 'Kind'
disc_type = c_name(name) + 'Kind'
for key in members:
assert (members[key] in builtin_types.keys()