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 <ebl...@redhat.com> > Reviewed-by: Markus Armbruster <arm...@redhat.com> > > --- >
> +++ 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