From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
"open list:Block layer core" <qemu-block@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Jason Wang <jasowang@redhat.com>,
qemu-devel@nongnu.org, Vincenzo Maffione <v.maffione@gmail.com>,
Luiz Capitulino <lcapitulino@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Giuseppe Lettieri <g.lettieri@iet.unipi.it>,
Luigi Rizzo <rizzo@iet.unipi.it>,
Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: Re: [Qemu-devel] [PATCH v4 07/10] qapi: Don't special-case simple union wrappers
Date: Tue, 8 Mar 2016 09:16:35 -0700 [thread overview]
Message-ID: <56DEFAE3.7040704@redhat.com> (raw)
In-Reply-To: <87y49t55ae.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 1918 bytes --]
On 03/08/2016 08:59 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> 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.
>> - 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;
>> -''')
>> + variants.tag_member.type.prefix),
>> + c_type=var.type.c_name(), c_name=c_name(var.name))
>>
>> ret += mcgen('''
>> default:
>
> This stupid special case has given us enough trouble, good to see it
> gone!
Yeah, it was a nice feeling to get to this point!
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-03-08 16:16 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-05 16:16 [Qemu-devel] [PATCH v4 00/10] easier unboxed visits/qapi implicit types Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 01/10] qapi: Assert in places where variants are not handled Eric Blake
2016-03-08 10:12 ` Markus Armbruster
2016-03-08 15:49 ` Eric Blake
2016-03-08 17:46 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 02/10] qapi: Fix command with named empty argument type Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 03/10] qapi: Make c_type() more OO-like Eric Blake
2016-03-08 10:54 ` Markus Armbruster
2016-03-08 15:50 ` Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 04/10] qapi: Emit implicit structs in generated C Eric Blake
2016-03-08 14:24 ` Markus Armbruster
2016-03-08 16:03 ` Eric Blake
2016-03-08 19:09 ` Markus Armbruster
2016-03-09 5:42 ` Eric Blake
2016-03-09 7:23 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 05/10] qapi: Utilize implicit struct visits Eric Blake
2016-03-08 15:10 ` Markus Armbruster
2016-03-08 16:11 ` Eric Blake
2016-03-08 18:09 ` Markus Armbruster
2016-03-08 18:28 ` Eric Blake
2016-03-08 19:21 ` Markus Armbruster
2016-03-09 23:28 ` Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 06/10] qapi-commands: Inline single-use helpers of gen_marshal() Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 07/10] qapi: Don't special-case simple union wrappers Eric Blake
2016-03-08 15:59 ` Markus Armbruster
2016-03-08 16:16 ` Eric Blake [this message]
2016-03-08 18:10 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 08/10] qapi: Allow anonymous base for flat union Eric Blake
2016-03-08 16:23 ` Markus Armbruster
2016-03-08 16:29 ` Eric Blake
2016-03-08 18:14 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 09/10] qapi: Use anonymous bases in QMP flat unions Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 10/10] qapi: Populate info['name'] for each entity Eric Blake
2016-03-08 16:46 ` Markus Armbruster
2016-03-08 16:59 ` Eric Blake
2016-03-08 19:14 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56DEFAE3.7040704@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=famz@redhat.com \
--cc=g.lettieri@iet.unipi.it \
--cc=imammedo@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rizzo@iet.unipi.it \
--cc=samuel.thibault@ens-lyon.org \
--cc=v.maffione@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.