summaryrefslogtreecommitdiffstats
path: root/tests/qapi-schema/flat-union-empty.out
diff options
context:
space:
mode:
authorEric Blake2016-02-18 07:48:16 +0100
committerMarkus Armbruster2016-02-19 11:08:56 +0100
commit02a57ae32b08e8981b59979b80e682c9a153e94d (patch)
tree418d1597e1ea5ff8e3f119fe453e990746299fe3 /tests/qapi-schema/flat-union-empty.out
parentqapi: Simplify excess input reporting in input visitors (diff)
downloadqemu-02a57ae32b08e8981b59979b80e682c9a153e94d.tar.gz
qemu-02a57ae32b08e8981b59979b80e682c9a153e94d.tar.xz
qemu-02a57ae32b08e8981b59979b80e682c9a153e94d.zip
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>
Diffstat (limited to 'tests/qapi-schema/flat-union-empty.out')
-rw-r--r--tests/qapi-schema/flat-union-empty.out9
1 files changed, 0 insertions, 9 deletions
diff --git a/tests/qapi-schema/flat-union-empty.out b/tests/qapi-schema/flat-union-empty.out
index eade2d5ac6..e69de29bb2 100644
--- a/tests/qapi-schema/flat-union-empty.out
+++ b/tests/qapi-schema/flat-union-empty.out
@@ -1,9 +0,0 @@
-object :empty
-object Base
- member type: Empty optional=False
-enum Empty []
-enum QType ['none', 'qnull', 'qint', 'qstring', 'qdict', 'qlist', 'qfloat', 'qbool']
- prefix QTYPE
-object Union
- base Base
- tag type