On 09/29/2014 02:27 AM, Markus Armbruster wrote: > Markus Armbruster <arm...@redhat.com> writes: > >> Eric Blake <ebl...@redhat.com> 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 <ebl...@redhat.com> > [...] >>> @@ -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
signature.asc
Description: OpenPGP digital signature