aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi-visit.py
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-05-14 06:50:58 -0600
committerMarkus Armbruster <armbru@redhat.com>2015-05-14 18:21:17 +0200
commitbb33729043ceda56b4068db13bdc17786ebd0ed0 (patch)
treea51b7255465b493421a475999946eb5d50ca6ab4 /scripts/qapi-visit.py
parent83a02706bb1fd31c93eab755de543dfe228682d4 (diff)
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>
Diffstat (limited to 'scripts/qapi-visit.py')
-rw-r--r--scripts/qapi-visit.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index b50072425e..d1ec70b964 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -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('''