[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 24/36] qapi: More rigourous checking of types
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v6 24/36] qapi: More rigourous checking of types |
Date: |
Tue, 28 Apr 2015 13:30:00 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Eric Blake <address@hidden> writes:
> Now that we know every expression is valid with regards to
> its keys, we can add further tests that those keys refer to
> valid types. With this patch, all uses of a type (the 'data':
> of command, type, union, alternate, and event; the 'returns':
> of command; the 'base': of type and union) must resolve to an
> appropriate subset of metatypes declared by the current qapi
> parse; this includes recursing into each member of a data
> dictionary. Dealing with '**' and nested anonymous structs
> will be done in later patches.
>
> Update the testsuite to match improved output.
>
> Signed-off-by: Eric Blake <address@hidden>
[...]
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index 686bc86..9f64a0d 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
[...]
> @@ -352,6 +414,11 @@ def check_union(expr, expr_info):
>
> # Check every branch
> for (key, value) in members.items():
> + # Each value must name a known type; futhermore, in flat unions,
furthermore
> + # branches must be a struct
> + check_type(expr_info, "Member '%s' of union '%s'" % (key, name),
> + value, allow_array=True, allow_metas=allow_metas)
> +
> # If the discriminator names an enum type, then all members
> # of 'data' must also be members of the enum type.
> if enum_define:
[...]
Regardless,
Reviewed-by: Markus Armbruster <address@hidden>
- Re: [Qemu-devel] [PATCH v6 16/36] qapi: Use 'alternate' to replace anonymous union, (continued)
- [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
- [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
- Re: [Qemu-devel] [PATCH v6 24/36] qapi: More rigourous checking of types,
Markus Armbruster <=
- [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
- [Qemu-devel] [PATCH v6 29/36] qapi: Document 'struct' metatype, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 31/36] qapi: Merge UserDefTwo and UserDefNested in tests, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 34/36] qapi: Drop inline nested structs in query-pci, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 33/36] qapi: Drop inline nested struct in query-version, Eric Blake, 2015/04/05
- [Qemu-devel] [PATCH v6 35/36] qapi: Drop support for inline nested types, Eric Blake, 2015/04/05