[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 09/16] qapi: Permit alternates with just one
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 09/16] qapi: Permit alternates with just one branch |
Date: |
Tue, 10 Sep 2019 11:30:14 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/10/19 1:37 AM, Markus Armbruster wrote:
> A union or alternate without branches makes no sense and doesn't work:
> it can't be instantiated. A union or alternate with just one branch
> works, but is degenerate. We accept the former, but reject the
> latter. Weird. docs/devel/qapi-code-gen.txt doesn't mention the
> difference. It claims an alternate definition is "is similar to a
> simple union type".
>
> Permit degenerate alternates to make them consistent with unions.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> scripts/qapi/common.py | 6 ++----
> tests/qapi-schema/alternate-empty.err | 2 +-
> tests/qapi-schema/alternate-empty.json | 4 ++--
> tests/qapi-schema/qapi-schema-test.json | 4 +++-
> tests/qapi-schema/qapi-schema-test.out | 6 ++++--
> 5 files changed, 12 insertions(+), 10 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
(Might make sense if one of the branches is conditional, where depending
on compile-time options it could be a two-branch or a one-branch alternate)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v2 04/16] docs/devel/qapi-code-gen: Minor specification fixes, (continued)
- [Qemu-devel] [PATCH v2 11/16] qapi: Adjust frontend errors to say enum value, not member, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 10/16] qapi: Permit omitting all flat union branches, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 06/16] qapi: Restrict strings to printable ASCII, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 09/16] qapi: Permit alternates with just one branch, Markus Armbruster, 2019/09/10
- Re: [Qemu-devel] [PATCH v2 09/16] qapi: Permit alternates with just one branch,
Eric Blake <=
- [Qemu-devel] [PATCH v2 12/16] docs/devel/qapi-code-gen: Reorder sections for readability, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 16/16] qapi: Tweak code to match docs/devel/qapi-code-gen.txt, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 07/16] qapi: Drop support for escape sequences other than \\, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 13/16] docs/devel/qapi-code-gen: Rewrite compatibility considerations, Markus Armbruster, 2019/09/10