[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 13/19] qapi: Normalize 'if' in check_exprs(), li
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 13/19] qapi: Normalize 'if' in check_exprs(), like other sugar |
Date: |
Tue, 17 Sep 2019 13:14:52 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/14/19 10:35 AM, Markus Armbruster wrote:
> We normalize shorthand to longhand forms in check_expr(): enumeration
> values with normalize_enum(), feature values with
> normalize_features(), struct members, union branches and alternate
> branches with normalize_members(). If conditions are an exception: we
> normalize them in QAPISchemaEntity.check() and
> QAPISchemaMember.__init(), with listify_cond(). The idea goes back to
> commit 2cbc94376e "qapi: pass 'if' condition into QAPISchemaEntity
> objects", v3.0.0.
>
> Normalize in check_expr() instead, with new helper normalize_if().
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> scripts/qapi/common.py | 26 +++++++++++++++-----------
> 1 file changed, 15 insertions(+), 11 deletions(-)
>
Definitely more consistent.
> @@ -904,6 +905,7 @@ def check_union(expr, info):
> check_known_keys(info, "member '%s' of union '%s'" % (key, name),
> value, ['type'], ['if'])
> check_if(value, info)
> + normalize_if(value)
Is it worth combining check_if() and normalize_if() into a single helper
function, since they always seem to be paired?
Reviewed-by: Eric Blake <address@hidden>
--
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 16/19] qapi: Delete useless check_exprs() code for simple union kind, (continued)
- [Qemu-devel] [PATCH 15/19] qapi: Clean up around check_known_keys(), Markus Armbruster, 2019/09/14
- [Qemu-devel] [PATCH 17/19] qapi: Fix to .check() empty structs just once, Markus Armbruster, 2019/09/14
- [Qemu-devel] [PATCH 07/19] qapi: Use quotes more consistently in frontend error messages, Markus Armbruster, 2019/09/14
- [Qemu-devel] [PATCH 09/19] qapi: Remove null from schema language, Markus Armbruster, 2019/09/14
- [Qemu-devel] [PATCH 13/19] qapi: Normalize 'if' in check_exprs(), like other sugar, Markus Armbruster, 2019/09/14
- Re: [Qemu-devel] [PATCH 13/19] qapi: Normalize 'if' in check_exprs(), like other sugar,
Eric Blake <=