aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema/flat-union-incomplete-branch.err
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-07-13 21:50:13 -0600
committerMarkus Armbruster <armbru@redhat.com>2016-07-19 13:21:08 +0200
commitd0b182392d0281ef780e3effcb82677a004f1f97 (patch)
tree3011a96e40c530c43e92fffc4f6d59053b6e7e57 /tests/qapi-schema/flat-union-incomplete-branch.err
parentcebea510579ed43724156cc596a8ff14ba208740 (diff)
qapi: Require all branches of flat union enum to be covered
We were previously enforcing that all flat union branches were found in the corresponding enum, but not that all enum values were covered by branches. The resulting generated code would abort() if the user passes the uncovered enum value. We don't automatically treat non-present branches in a flat union as empty types, for symmetry with simple unions (there, the enum type is generated from the list of all branches, so there is no way to omit a branch but still have it be part of the union). A later patch will add shorthand so that branches that are empty in flat unions can be declared as 'branch':{} instead of 'branch':'Empty', to avoid the need for an otherwise useless explicit empty type. [Such shorthand for simple unions is a bit harder to justify, since we would still have to generate a wrapper type that parses 'data':{}, rather than truly being an empty branch with no additional siblings to the 'type' member.] Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1468468228-27827-3-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema/flat-union-incomplete-branch.err')
-rw-r--r--tests/qapi-schema/flat-union-incomplete-branch.err1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/qapi-schema/flat-union-incomplete-branch.err b/tests/qapi-schema/flat-union-incomplete-branch.err
new file mode 100644
index 0000000000..e826bf0789
--- /dev/null
+++ b/tests/qapi-schema/flat-union-incomplete-branch.err
@@ -0,0 +1 @@
+tests/qapi-schema/flat-union-incomplete-branch.json:6: Union 'TestUnion' data missing 'value2' branch