[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 13/19] qapi: More rigourous checking of types
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v4 13/19] qapi: More rigourous checking of types |
Date: |
Mon, 29 Sep 2014 10:27:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Markus Armbruster <address@hidden> writes:
> 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 references to a type (the
>> 'data': of command, type, union, and event, and the 'returns':
>> of command) must resolve to a builtin or another type declared
>> by the current qapi parse; this includes recursing into each
>> member of a data dictionary. Dealing with '**' and nested
>> sub-structs will be done in later patches.
>>
>> Update the testsuite to match improved output.
>>
>> Signed-off-by: Eric Blake <address@hidden>
[...]
>> @@ -262,6 +308,15 @@ def check_command(expr, expr_info):
>> raise QAPIExprError(expr_info,
>> "command '%s' is already defined" % name)
>> commands.append(name)
>> + check_type(expr_info, "'data' for command '%s'" % name,
>> + expr.get('data'), allow_array=True,
>> + allowed_names=['union', 'struct'])
>> + check_type(expr_info, "'base' for command '%s'" % name,
>> + expr.get('base'), allowed_names=['struct'],
>> + allow_dict=False)
>> + check_type(expr_info, "'returns' for command '%s'" % name,
>> + expr.get('returns'), allow_array=True,
>> + allowed_names=['built-in', 'union', 'struct', 'enum'])
>>
>
> Nicely done.
Wait a sec! What's a command's 'base'?
[...]
- Re: [Qemu-devel] [PATCH v4 08/19] qapi: Better error messages for bad expressions, (continued)
[Qemu-devel] [PATCH v4 09/19] qapi: Add tests of redefined expressions, Eric Blake, 2014/09/19
[Qemu-devel] [PATCH v4 11/19] qapi: Add tests of type bypass, Eric Blake, 2014/09/19
[Qemu-devel] [PATCH v4 13/19] qapi: More rigourous checking of types, Eric Blake, 2014/09/19
[Qemu-devel] [PATCH v4 07/19] qapi: Add some expr tests, Eric Blake, 2014/09/19
[Qemu-devel] [PATCH v4 12/19] qapi: Add some type check tests, Eric Blake, 2014/09/19
Re: [Qemu-devel] [PATCH v4 12/19] qapi: Add some type check tests, Eric Blake, 2014/09/25