qemu-devel
[Top][All Lists]
Advanced

[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: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v4 13/19] qapi: More rigourous checking of types
Date: Mon, 29 Sep 2014 08:26:11 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

On 09/29/2014 02:27 AM, Markus Armbruster wrote:
> 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)

>>
>> Nicely done.
> 
> Wait a sec!  What's a command's 'base'?

Blech. You're right - only 'union' and 'struct' have a base.  And since
an earlier patch already filtered out 'base' as a non-allowed key for
'command, this check_type is dead code.  All the more reason for me to
spin v5 :)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]