From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v9 08/17] tests: Convert to new qapi union layout
Date: Thu, 22 Oct 2015 16:01:57 +0200 [thread overview]
Message-ID: <871tcn0zoq.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1444968943-11254-9-git-send-email-eblake@redhat.com> (Eric Blake's message of "Thu, 15 Oct 2015 22:15:33 -0600")
Eric Blake <eblake@redhat.com> writes:
> We have two issues with our qapi union layout:
> 1) Even though the QMP wire format spells the tag 'type', the
> C code spells it 'kind', requiring some hacks in the generator.
> 2) The C struct uses an anonymous union, which places all tag
> values in the same namespace as all non-variant members. This
> leads to spurious collisions if a tag value matches a QMP name.
>
> Make the conversion to the new layout for testsuite code.
>
> Note that this includes updating an error message regarding a
> collision. After the conversion to the new union qapi layout
> is complete, there will still be further patches for cleaning
> up collision detection, since the use of a named union can
> completely eliminate the collision wording changed here.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> ---
> v9: new patch, but incorporates parts of v5 31/46 and Markus' RFC:
> http://lists.gnu.org/archive/html/qemu-devel/2015-10/msg02236.html
> ---
> scripts/qapi.py | 2 +-
> tests/qapi-schema/union-clash-type.err | 2 +-
> tests/qapi-schema/union-clash-type.json | 6 +--
> tests/test-qmp-commands.c | 4 +-
> tests/test-qmp-input-visitor.c | 78 ++++++++++++++++-----------------
> tests/test-qmp-output-visitor.c | 42 +++++++++---------
> 6 files changed, 66 insertions(+), 68 deletions(-)
>
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index 1e7e08b..aab2b46 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -546,7 +546,7 @@ def check_union(expr, expr_info):
> base = expr.get('base')
> discriminator = expr.get('discriminator')
> members = expr['data']
> - values = {'MAX': '(automatic)', 'KIND': '(automatic)'}
> + values = {'MAX': '(automatic)', 'TYPE': '(automatic tag)'}
>
> # Two types of unions, determined by discriminator.
>
Umm, does this really belong to this patch?
> diff --git a/tests/qapi-schema/union-clash-type.err b/tests/qapi-schema/union-clash-type.err
> index a5dead1..c14bbdd 100644
> --- a/tests/qapi-schema/union-clash-type.err
> +++ b/tests/qapi-schema/union-clash-type.err
> @@ -1 +1 @@
> -tests/qapi-schema/union-clash-type.json:8: Union 'TestUnion' member 'kind' clashes with '(automatic)'
> +tests/qapi-schema/union-clash-type.json:6: Union 'TestUnion' member 'type' clashes with '(automatic tag)'
> diff --git a/tests/qapi-schema/union-clash-type.json b/tests/qapi-schema/union-clash-type.json
> index cfc256b..641b2d5 100644
> --- a/tests/qapi-schema/union-clash-type.json
> +++ b/tests/qapi-schema/union-clash-type.json
> @@ -1,9 +1,7 @@
> # Union branch 'type'
> # Reject this, because we would have a clash in generated C, between the
> -# simple union's implicit tag member 'kind' and the branch name 'kind'
> +# simple union's implicit tag member 'type' and the branch name 'type'
> # within the union.
> -# TODO: Even when the generated C is switched to use 'type' rather than
> -# 'kind', to match the QMP spelling, the collision should still be detected.
> -# Or, we could munge the branch name to allow compilation.
> +# TODO: If desired, we could munge the branch name to allow compilation.
Let's mark it TODO only if we intend to revisit the idea of munging
branch names.
> { 'union': 'TestUnion',
> 'data': { 'kind': 'int', 'type': 'str' } }
[Mind-numbing mechanical switch to u. and from kind to type...]
next prev parent reply other threads:[~2015-10-22 14:02 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
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 [this message]
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=871tcn0zoq.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@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.