[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 39/39] qapi: Check for member name conflicts
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v7 39/39] qapi: Check for member name conflicts with a base class |
Date: |
Fri, 01 May 2015 14:22:51 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 04/29/2015 07:06 AM, Eric Blake wrote:
> Our type inheritance for both 'struct' and for flat 'union' merges
> key/value pairs from the base class with those from the type in
> question. Although the C code currently boxes things so that there
> is a distinction between which member is referred to, the QMP wire
> format does not allow passing a key more than once in a single
> object. Besides, if we ever change the generated C code to not be
> quite so boxy, we'd want to avoid duplicate member names there,
> too.
>
> Fix a testsuite entry added in an earlier patch, as well as adding
> a couple more tests to ensure we have appropriate coverage.
>
> Signed-off-by: Eric Blake <address@hidden>
> Reviewed-by: Markus Armbruster <address@hidden>
>
> ---
>
> +++ b/scripts/qapi.py
> @@ -414,6 +414,18 @@ def check_type(expr_info, source, value, allow_array =
> False,
> allow_metas=['built-in', 'union', 'alternate', 'struct',
> 'enum'])
>
> +def check_member_clash(expr_info, base_name, data, source = ""):
> + base = find_struct(base_name)
> + assert base
> + base_members = base['data']
> + for key in data.keys():
> + if key in base_members:
Fails to consider what happens when one but not both of the dictionaries
being compared marked the member as optional (that is, the key '*name'
must be treated as conflicting with 'name'). Followup on the way; it's
not a regression, so you can either squash into this or leave as
standalone. Again, let me know if you'd rather me post a v8 with all my
squashes folded in.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v7 39/39] qapi: Check for member name conflicts with a base class,
Eric Blake <=