qapi: allow empty branches in flat unions
commit800877bb1639d38ffaebe312a37b61c66bb10c83
authorAnton Nefedov <anton.nefedov@virtuozzo.com>
Mon, 18 Jun 2018 08:40:05 +0000 (18 11:40 +0300)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 22 Jun 2018 14:33:46 +0000 (22 16:33 +0200)
tree766371f9d2bb317d702ed6c4317d9ae75a0bd67f
parentfe170d8bfaa12d63117cad8707ac18c3b2f3bb8e
qapi: allow empty branches in flat unions

It often happens that just a few discriminator values imply extra data in
a flat union. Existing checks did not make possible to leave other values
uncovered. Such cases had to be worked around by either stating a dummy
(empty) type or introducing another (subset) discriminator enumeration.

Both options create redundant entities in qapi files for little profit.

With this patch it is not necessary anymore to add designated union
fields for every possible value of a discriminator enumeration.

Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
Message-Id: <1529311206-76847-2-git-send-email-anton.nefedov@virtuozzo.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
docs/devel/qapi-code-gen.txt
scripts/qapi/common.py
scripts/qapi/types.py
scripts/qapi/visit.py
tests/Makefile.include
tests/qapi-schema/flat-union-incomplete-branch.err [deleted file]
tests/qapi-schema/flat-union-incomplete-branch.exit [deleted file]
tests/qapi-schema/flat-union-incomplete-branch.json [deleted file]
tests/qapi-schema/flat-union-incomplete-branch.out [deleted file]
tests/qapi-schema/qapi-schema-test.json
tests/qapi-schema/qapi-schema-test.out