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.
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index c15305f..e511be3 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -202,11 +202,11 @@
}
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()