[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v4 07/10] qapi: Don't special-case
Re: [Qemu-block] [Qemu-devel] [PATCH v4 07/10] qapi: Don't special-case simple union wrappers
Tue, 08 Mar 2016 19:10:59 +0100
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
Eric Blake <address@hidden> writes:
> On 03/08/2016 08:59 AM, Markus Armbruster wrote:
>> Eric Blake <address@hidden> writes:
>>> Simple unions were carrying a special case that hid their 'data'
>>> QMP member from the resulting C struct, via the hack method
>>> QAPISchemaObjectTypeVariant.simple_union_type(). But by using
>>> the work we started by unboxing flat union and alternate
>>> branches, coupled with the ability to visit the members of an
>>> implicit type, we can now expose the simple union's implicit
>>> type in qapi-types.h:
>>> +++ b/scripts/qapi.py
>>> @@ -1006,7 +1006,6 @@ class QAPISchemaObjectType(QAPISchemaType):
>>> return c_name(self.name) + pointer_suffix
>>> def c_unboxed_type(self):
>>> - assert not self.is_implicit()
>> Doesn't this belong into PATCH 04?
>>> return c_name(self.name)
> Maybe. Patch 3 kept the assertion out of straight code refactoring, and
> patch 4 didn't use c_unboxed_type(), so this was the first place where I
> had to weaken the assertion. But moving it into patch 4 doesn't seem
> like it would hurt, as it is still semantically related to the fact that
> we are planning on allowing an unboxed implicit type.
PATCH 04 drops the assertion from c_name(). Let's keep the two
>>> - visit_type_%(c_type)s_members(v, &obj->u.%(c_name)s, &err);
>>> - c_type=var.type.c_name(),
>>> - c_name=c_name(var.name))
>>> - ret += mcgen('''
>>> - break;
>>> + c_type=var.type.c_name(), c_name=c_name(var.name))
>>> ret += mcgen('''
>> This stupid special case has given us enough trouble, good to see it
> Yeah, it was a nice feeling to get to this point!