[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: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH RFC v3 26/32] qapi: Introduce a first class 'any' type |
Date: |
Sat, 08 Aug 2015 08:24:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> 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.
It's 2D-by-trickery. Unlike the existing trick of wrapping the inner
array in a struct, this one isn't visible on the wire, though. It
requires giving up some type checking.
>From a backend point of view, array of any type should just work. We're
already debating whether we want them under PATCH 02, so let's continue
there.
>> +++ 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.
Yes, to keep the test case complete.
> 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.
anyList is fixed-type, too: the fixed type is QObject * ;)
['any'] isn't ABI until we actually use it in an external interface.
- Re: [Qemu-devel] [PATCH RFC v3 32/32] qapi-introspect: Hide type names, (continued)
- [Qemu-devel] [PATCH RFC v3 29/32] qapi: Pseudo-type '**' is now unused, drop it, Markus Armbruster, 2015/08/04
- [Qemu-devel] [PATCH RFC v3 24/32] qapi-commands: De-duplicate output marshaling functions, Markus Armbruster, 2015/08/04
- [Qemu-devel] [PATCH RFC v3 17/32] Revert "qapi: Generate comments to simplify splitting for review", Markus Armbruster, 2015/08/04
- [Qemu-devel] [PATCH RFC v3 16/32] qapi: Generate comments to simplify splitting for review, Markus Armbruster, 2015/08/04
- [Qemu-devel] [PATCH RFC v3 26/32] qapi: Introduce a first class 'any' type, Markus Armbruster, 2015/08/04
- [Qemu-devel] [PATCH RFC v3 19/32] qapi: Clean up after recent conversions to QAPISchemaVisitor, Markus Armbruster, 2015/08/04
- [Qemu-devel] [PATCH RFC v3 22/32] qapi: Rename qmp_marshal_input_FOO() to qmp_marshal_FOO(), Markus Armbruster, 2015/08/04
- [Qemu-devel] [PATCH RFC v3 30/32] qapi: New QMP command query-schema for QMP schema introspection, Markus Armbruster, 2015/08/04