From fa6af0733a95ed3709e24ef0d94d44ef5f1c7b48 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 20 Feb 2018 15:38:36 -0500 Subject: [PATCH] qapi-visit: Honor prefix of discriminator enum When we added support for a user-specified prefix for an enum type (commit 351d36e), we forgot to teach the qapi-visit code to honor that prefix in the case of using a prefixed enum as the discriminator for a flat union. While there is still some on-list debate on whether we want to keep prefixes, we should at least make it work as long as it is still part of the code base. Backports commit 9d3524b39e1fe5f3bb7a990ad7841e469e954a3b from qemu --- qemu/scripts/qapi-visit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu/scripts/qapi-visit.py b/qemu/scripts/qapi-visit.py index 4d73e02f..462327c9 100644 --- a/qemu/scripts/qapi-visit.py +++ b/qemu/scripts/qapi-visit.py @@ -294,7 +294,8 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error case %(case)s: ''', case=c_enum_const(variants.tag_member.type.name, - var.name)) + var.name, + variants.tag_member.type.prefix)) if simple_union_type: ret += mcgen(''' visit_type_%(c_type)s(v, "data", &(*obj)->u.%(c_name)s, &err);