This website requires JavaScript.
Explore
Help
Sign In
OpenE2K
/
qemu-e2k
Watch
13
Star
4
Fork
0
You've already forked qemu-e2k
Code
Issues
4
Pull Requests
Projects
2
Releases
Activity
8b084489b0
qemu-e2k
/
tests
/
qapi-schema
/
union-empty.exit
2 lines
2 B
Plaintext
Raw
Normal View
History
Unescape
Escape
qapi: Forbid empty unions and useless alternates Empty unions serve no purpose, and while we compile with gcc which permits them, strict C99 forbids them. We happen to inject a dummy 'void *data' member into the C unions that represent QAPI unions and alternates, but we want to get rid of that member (it pollutes the namespace for no good reason), which would leave us with an empty union if the user didn't provide any branches. While empty structs make sense in QAPI, empty unions don't add any expressiveness to the QMP language. So prohibit them at parse time. Update the documentation and testsuite to match. Note that the documentation already mentioned that alternates should have "two or more JSON data types"; so this also fixes the code to enforce that. However, we have existing uses of a union type with only one branch, so the 2-or-more strictness is intentionally limited to alternates. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1455778109-6278-3-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-02-18 07:48:16 +01:00
1
Reference in New Issue
Copy Permalink