From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v9 07/17] qapi: Start converting to new qapi union layout
Date: Thu, 22 Oct 2015 08:09:44 -0600 [thread overview]
Message-ID: <5628EE28.8070003@redhat.com> (raw)
In-Reply-To: <87611z100f.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 3612 bytes --]
On 10/22/2015 07:54 AM, Markus Armbruster wrote:
>
> This is clever and ugly in equal measure. I respect that. Fortunately,
> it's also temporary.
>
>> Flat unions do not need the anonymous union for the tag member,
>> as we already fixed that to use the member name instead of 'kind'
>> back in commit 0f61af3e.
>
> Unlike then, we need multiple commits for simple unions, because they're
> more widely used?
Yes. In fact, both you and I expressed surprise back then that the main
body of qemu didn't need adjusting - our only use of flat unions was
hidden behind QDict manipulations rather than direct generated qapi
struct, explaining why nothing was affected when we converted flat
unions. But a useful note for the commit message at any rate.
>
>> On the other hand, the duplication
>> means that we temporarily cannot support 'u' as a branch name.
>
> Separate paragraph, because now you're talking about the *other*
> anonymous union.
>
>> Later, when the conversions are complete, we will remove the
>> duplication hacks and restore support for 'u' as a branch name.
And based on comments on 3/17, I'm deferring any testsuite changes
related to 'u' collisions until after this conversion to inline base is
complete, so this part of the commit message actually disappears in v10
because I'm no longer touching qapi-schema-test this early.
>>
>> Note, however, that we do not rename the generated enum, which
>> is still 'FooKind'. A further patch could generate implicit
>> enums as 'FooType', but that causes more churn to C code, and
>> gets harder since the generator already reserved the '*Kind'
>> namespace, but there are already QMP constructs with '*Type'
>> naming which means we cannot easily reserve it for qapi.
>
> Oh, we can reserve whatever we want in QAPI, it's just a lot of churn to
> adapt the QAPI-using code.
>
> I'd simply say "but that would cause substantial churn to C code, as
> there are already QAPI definitions with '*Type' naming".
Okay.
>> for var in variants.variants:
>> # Ugly special case for simple union TODO get rid of it
>> typ = var.simple_union_type() or var.type
>> - ret += mcgen('''
>> + tmp += mcgen('''
>> %(c_type)s %(c_name)s;
>> ''',
>> c_type=typ.c_type(),
>> c_name=c_name(var.name))
>>
>> + ret += tmp
>> + ret += ' ' + '\n '.join(tmp.split('\n'))
>> ret += mcgen('''
>> + } u;
>> };
>> };
>> ''')
>
> It took me some head-scratching to understand why this generates
> correctly indented output. If it wasn't temporary code, I'd ask for
> cleanup.
Would a comment help? It's because we add 4 spaces after each newline,
but need an indent prior to the first line of tmp, and the '} u;' line
picks up four spaces after the last line of tmp.
>
> Second part: convert qapi-visit.py. Not mentioned in commit message.
> Separate patch, perhaps?
Sure, I could split.
>
> Third part: work around temporary clash with 'u'. Needs to remain in
> this patch, obviously. Suggest to amend the commit message to say
>
> On the other hand, the duplication means that we temporarily cannot
> support 'u' as a branch name. Adapt a few tests that do.
Or, rather, dropped entirely, because the tests for collisions with 'u'
will be deferred until after the conversion is complete.
--
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:[~2015-10-22 14:10 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 4:15 [Qemu-devel] [PATCH v9 00/17] qapi collision reduction (post-introspection subset B') Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 01/17] qapi: Add tests for reserved name abuse Eric Blake
2015-10-19 16:05 ` Markus Armbruster
2015-10-20 16:23 ` Eric Blake
2015-10-21 12:08 ` Markus Armbruster
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 02/17] qapi: Reserve '*List' type names for arrays Eric Blake
2015-10-19 16:14 ` Markus Armbruster
2015-10-20 18:12 ` Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 03/17] qapi: Reserve 'u' and 'has[-_]*' member names Eric Blake
2015-10-19 17:19 ` Markus Armbruster
2015-10-20 21:29 ` Eric Blake
2015-10-21 13:08 ` Markus Armbruster
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 04/17] vnc: hoist allocation of VncBasicInfo to callers Eric Blake
2015-10-20 7:38 ` Markus Armbruster
2015-10-20 8:54 ` Gerd Hoffmann
2015-10-20 14:46 ` Markus Armbruster
2015-10-20 22:53 ` Eric Blake
2015-10-21 11:02 ` Markus Armbruster
2015-10-21 11:16 ` Daniel P. Berrange
2015-10-23 13:13 ` Markus Armbruster
2015-10-20 22:56 ` Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members Eric Blake
2015-10-16 19:12 ` [Qemu-devel] [PATCH v9 05.5/17] fixup to " Eric Blake
2015-10-20 12:09 ` [Qemu-devel] [PATCH v9 05/17] " Markus Armbruster
2015-10-20 16:08 ` Eric Blake
2015-10-21 13:34 ` Markus Armbruster
2015-10-21 21:16 ` Eric Blake
2015-10-22 6:28 ` Markus Armbruster
2015-10-23 1:50 ` Eric Blake
2015-10-23 6:26 ` Markus Armbruster
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 06/17] qapi-visit: Remove redundant functions for flat union base Eric Blake
2015-10-21 17:36 ` Markus Armbruster
2015-10-21 19:01 ` Eric Blake
2015-10-22 8:32 ` Markus Armbruster
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 07/17] qapi: Start converting to new qapi union layout Eric Blake
2015-10-22 13:54 ` Markus Armbruster
2015-10-22 14:09 ` Eric Blake [this message]
2015-10-22 14:44 ` Markus Armbruster
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 08/17] tests: Convert " Eric Blake
2015-10-22 14:01 ` Markus Armbruster
2015-10-22 14:22 ` Eric Blake
2015-10-22 14:57 ` Markus Armbruster
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 09/17] block: " Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 10/17] nbd: " Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 11/17] net: " Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 12/17] char: " Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 13/17] input: " Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 14/17] memory: " Eric Blake
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 15/17] tpm: " Eric Blake
2015-10-22 14:19 ` Markus Armbruster
2015-10-22 14:26 ` Eric Blake
2015-10-22 16:40 ` Eric Blake
2015-10-23 6:24 ` Markus Armbruster
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 16/17] qapi: Finish converting " Eric Blake
2015-10-22 14:50 ` Markus Armbruster
2015-10-16 4:15 ` [Qemu-devel] [PATCH v9 17/17] qapi: Simplify gen_struct_field() Eric Blake
2015-10-22 15:13 ` [Qemu-devel] [PATCH v9 00/17] qapi collision reduction (post-introspection subset B') 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=5628EE28.8070003@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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.