qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC v3 26/32] qapi: Introduce a first class 'any


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH RFC v3 26/32] qapi: Introduce a first class 'any' type
Date: Fri, 7 Aug 2015 13:30:21 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 08/04/2015 09:58 AM, Markus Armbruster wrote:
> It's first class, because unlike '**', it actually works, i.e. doesn't
> require 'gen': false.
> 
> '**' will go away next.
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> ---

> @@ -1039,8 +1040,7 @@ class QAPISchema(object):
>  
>      def _def_builtin_type(self, name, json_type, c_type, c_null):
>          self._def_entity(QAPISchemaBuiltinType(name, json_type, c_type, 
> c_null))
> -        if name != '**':
> -            self._make_array_type(name) # TODO really needed?
> +        self._make_array_type(name) # TODO really needed?

Do we really want to allow ['any'] in schemata?  That would imply the
possibility of a 2D array.

> +++ b/tests/qapi-schema/qapi-schema-test.json
> @@ -83,6 +83,8 @@
>    'returns': 'UserDefTwo' }
>  { 'command': 'user_def_cmd3', 'data': {'a': 'int', '*b': 'int' },
>    'returns': 'int' }
> +# note: command name 'guest-sync' chosen to avoid "cannot use built-in" error
> +{ 'command': 'guest-sync', 'data': { 'arg': 'any' }, 'returns': 'any' }
>  

In particular, if we DO want to allow it, this file should be enhanced
to include ['any'] in the UserDefNativeListUnion.

As it is, JSON allows mixed-type arrays, but all our uses of QList are
fixed-type (all elements share the same type); allowing an array of any
element may prove to be problematic.

-- 
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]