qapi: Permit omitting all flat union branches

Absent flat union branches default to the empty struct (since commit
800877bb16 "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]
This commit is contained in:
Markus Armbruster 2019-09-13 22:13:43 +02:00
parent f03255362a
commit 0ced9531f1
8 changed files with 27 additions and 14 deletions

View file

@ -436,8 +436,7 @@ Union types are used to let the user choose between several different
variants for an object. There are two flavors: simple (no
discriminator or base), and flat (both discriminator and base). A union
type is defined using a data dictionary as explained in the following
paragraphs. The data dictionary for either type of union must not
be empty.
paragraphs. Unions must have at least one branch.
A simple union type defines a mapping from automatic discriminator
values to data types like in this example: