Skip to content

Commit

Permalink
qapi: Allow enums in anonymous unions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
XanClic authored and stefanhaRH committed Sep 22, 2014
1 parent 7b17ce6 commit e775ba7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions scripts/qapi-types.py
Expand Up @@ -177,6 +177,8 @@ def generate_anon_union_qtypes(expr):
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"

Expand Down
3 changes: 2 additions & 1 deletion scripts/qapi-visit.py
Expand Up @@ -263,7 +263,8 @@ def generate_visit_anon_union(name, members):
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('''
Expand Down

0 comments on commit e775ba7

Please sign in to comment.