[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 08/36] qapi: Add some union tests
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v6 08/36] qapi: Add some union tests |
Date: |
Mon, 27 Apr 2015 18:18:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Eric Blake <address@hidden> writes:
> Demonstrate that the qapi generator doesn't deal well with unions
> that aren't up to par. Later patches will update the expected
> reseults as the generator is made stricter. A few tests work
> as planned, but most show poor or missing error messages.
>
> Of particular note, qapi-code-gen.txt documents 'base' only for
> flat unions, but the tests here demonstrate that we currently allow
> a 'base' to a simple union, although it is exercised only in the
> testsuite. Later patches will remove this undocumented feature, to
> give us more flexibility in adding other future extensions to union
> types. For example, one possible extension is the idea of a
> type-safe simple enum, where added fields tie the discriminator to
> a user-defined enum type rather than creating an implicit enum from
> the names in 'data'. But adding such safety on top of a simple
> enum with a base type could look ambiguous with a flat enum;
> besides, the documentation also mentions how any simple union can
> be represented by an equivalent flat union. So it will be simpler
> to just outlaw support for something we aren't using.
>
> Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
- [Qemu-devel] [PATCH v6 21/36] qapi: Allow true, false and null in schema json, (continued)
- [Qemu-devel] [PATCH v6 21/36] qapi: Allow true, false and null in schema json, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 17/36] qapi: Add some expr tests, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 19/36] qapi: Add tests of redefined expressions, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 22/36] qapi: Unify type bypass and add tests, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 18/36] qapi: Better error messages for bad expressions, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 16/36] qapi: Use 'alternate' to replace anonymous union, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 20/36] qapi: Better error messages for duplicated expressions, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 08/36] qapi: Add some union tests, Eric Blake, 2015/04/05
- Re: [Qemu-devel] [PATCH v6 08/36] qapi: Add some union tests,
Markus Armbruster <=
- [Qemu-devel] [PATCH v6 26/36] qapi: Whitelist commands that don't return dictionary, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 27/36] qapi: More rigorous checking for type safety bypass, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 25/36] qapi: Require valid names, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 24/36] qapi: More rigourous checking of types, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 23/36] qapi: Add some type check tests, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 28/36] qapi: Prefer 'struct' over 'type' in generator, Eric Blake, 2015/04/05