Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qapi: Permit omitting all flat union branches
Absent flat union branches default to the empty struct (since commit 800877b "qapi: allow empty branches in flat unions"). But an attempt to omit all of them is rejected with "Union 'FOO' has no branches". Harmless oddity, but it's easy to avoid, so do that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20190913201349.24332-11-armbru@redhat.com> [Commit message typo fixed]
- Loading branch information
Markus Armbruster
committed
Sep 24, 2019
1 parent
f032553
commit 0ced953
Showing
8 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
tests/qapi-schema/flat-union-empty.json:4: Union 'Union' cannot have empty 'data' | ||
tests/qapi-schema/flat-union-empty.json:4: Union 'Union' has no branches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# flat unions cannot be empty | ||
# flat union discriminator cannot be empty | ||
{ 'enum': 'Empty', 'data': [ ] } | ||
{ 'struct': 'Base', 'data': { 'type': 'Empty' } } | ||
{ 'union': 'Union', 'base': 'Base', 'discriminator': 'type', 'data': { } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
tests/qapi-schema/union-empty.json:2: Union 'Union' cannot have empty 'data' | ||
tests/qapi-schema/union-empty.json:2: Union 'Union' has no branches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# unions cannot be empty | ||
# simple unions cannot be empty | ||
{ 'union': 'Union', 'data': { } } |