Blob Blame Raw
From 3d016c34cdcc3cada9303eaa0a57ce847367e5d8 Mon Sep 17 00:00:00 2001
From: Amos Kong <akong@redhat.com>
Date: Fri, 8 Nov 2013 06:13:56 +0100
Subject: [PATCH 1/4] qapi: qapi-visit.py, fix list handling for union types

RH-Author: Amos Kong <akong@redhat.com>
Message-id: <1383891239-29531-2-git-send-email-akong@redhat.com>
Patchwork-id: 55608
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 1/4] qapi: qapi-visit.py, fix list handling for union types
Bugzilla: 848203
RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

From: Michael Roth <mdroth@linux.vnet.ibm.com>

Currently we assume non-list types when generating visitor routines for
union types. This is broken, since values like ['Type'] need to mapped
to 'TypeList'.

We already have a type_name() function to handle this that we use for
generating struct visitors, so use that here as well.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit c664aef551714e91b7d83a28617b6e767db30d11)
---
 scripts/qapi-visit.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 scripts/qapi-visit.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 71004ae..fc2b67a 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -309,7 +309,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
 ''',
                 abbrev = de_camel_case(name).upper(),
                 enum = c_fun(de_camel_case(key),False).upper(),
-                c_type=members[key],
+                c_type=type_name(members[key]),
                 c_name=c_fun(key))
 
     ret += mcgen('''
-- 
1.7.1