[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 07/18] qapi: Don't use info as witness of imp
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v8 07/18] qapi: Don't use info as witness of implicit object type |
Date: |
Tue, 13 Oct 2015 07:05:02 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 10/13/2015 05:40 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
>
>> @@ -900,6 +903,10 @@ class QAPISchemaEnumType(QAPISchemaType):
>> def check(self, schema):
>> assert len(set(self.values)) == len(self.values)
>>
>> + def is_implicit(self):
>> + # See QAPISchema._make_implicit_enum_type()
>> + return self.name[-4:] == 'Kind'
>> +
>> def c_type(self, is_param=False):
>> return c_name(self.name)
>>
>
> I believe this method...
>
>> @@ -970,12 +977,16 @@ class QAPISchemaObjectType(QAPISchemaType):
>> self.variants.check(schema, members, seen)
>> self.members = members
>>
>> + def is_implicit(self):
>> + # See QAPISchema._make_implicit_object_type()
>> + return self.name[0] == ':'
>> +
>
> ... as well as this one are redundant at this stage. They become
> necessary only when you start passing info != None to the constructor in
> PATCH 12. If I'm right, then moving the two to PATCH 12 makes sense.
I think you're right; we could float these hunks to where they become
important if there is a reason for a respin.
>> def _make_implicit_enum_type(self, name, values):
>> - name = name + 'Kind'
>> + name = name + 'Kind' # Use namespace reserved by add_name()
>
> This is the comment I suggested...
>
>> self._def_entity(QAPISchemaEnumType(name, None, values, None))
>> return name
>>
>> def _make_array_type(self, element_type):
>> + # TODO fooList namespace is not reserved; user can create
>> collisions,
>> + # or abuse our type system with ['fooList'] for 2D array
>
> ... and this is its buddy you added on your own initiative. Thanks!
>
> Did you actually try the abuse? If not, I'd say "or maybe abuse", out
> of caution.
Yes, back in an earlier version of your introspection work, we played
with 2D arrays, and concluded that it wasn't worth worrying about until
the queue is flushed:
https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg00551.html
But back then, when I was playing with it, I did confirm that
['fooList'] gets past the generator.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v8 00/18] post-introspection cleanups, subset B, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 03/18] qapi: Drop redundant alternate-good test, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 04/18] qapi: Move empty-enum to compile-time test, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 05/18] qapi: Drop redundant returns-int test, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 01/18] qapi: Use predicate callback to determine visit filtering, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 07/18] qapi: Don't use info as witness of implicit object type, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 08/18] qapi: Lazy creation of array types, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 14/18] qapi: Detect collisions in C member names, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 11/18] qapi: Simplify gen_struct_field(), Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 09/18] qapi: Create simple union type member earlier, Eric Blake, 2015/10/13
- [Qemu-devel] [PATCH v8 12/18] qapi: Track location that created an implicit type, Eric Blake, 2015/10/13