]> xenbits.xensource.com Git - qemu-upstream-unstable.git/commitdiff
qapi: Allow enums in anonymous unions
authorMax Reitz <mreitz@redhat.com>
Wed, 20 Aug 2014 17:59:34 +0000 (19:59 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 22 Sep 2014 10:39:33 +0000 (11:39 +0100)
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1408557576-14574-3-git-send-email-mreitz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scripts/qapi-types.py
scripts/qapi-visit.py

index b4632324a72869a36cb1ba84e01e210789dd1eb8..d2f815bca22f52d1ce6f4382328adb2f2a0b4877 100644 (file)
@@ -177,6 +177,8 @@ const int %(name)s_qtypes[QTYPE_MAX] = {
             qtype = "QTYPE_QDICT"
         elif find_union(qapi_type):
             qtype = "QTYPE_QDICT"
+        elif find_enum(qapi_type):
+            qtype = "QTYPE_QSTRING"
         else:
             assert False, "Invalid anonymous union member"
 
index c12969721ae03fbc72046425dcb62aa4e8b652b8..df9f7fb657b20cecf71e7d76b8f45437ae495137 100644 (file)
@@ -263,7 +263,8 @@ void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **e
     for key in members:
         assert (members[key] in builtin_types
             or find_struct(members[key])
-            or find_union(members[key])), "Invalid anonymous union member"
+            or find_union(members[key])
+            or find_enum(members[key])), "Invalid anonymous union member"
 
         enum_full_value = generate_enum_full_value(disc_type, key)
         ret += mcgen('''