mirror of
https://github.com/qemu/qemu.git
synced 2026-05-20 23:27:10 +00:00
qapi: Check for member name conflicts with a base class
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. Ensure that collisions are detected, regardless of whether there is a difference in opinion on whether the member name is optional. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
committed by
Markus Armbruster
parent
a7f5966b29
commit
ff55d72eaf
6
tests/qapi-schema/struct-base-clash.json
Normal file
6
tests/qapi-schema/struct-base-clash.json
Normal file
@@ -0,0 +1,6 @@
|
||||
# we check for no duplicate keys with base
|
||||
{ 'struct': 'Base',
|
||||
'data': { 'name': 'str' } }
|
||||
{ 'struct': 'Sub',
|
||||
'base': 'Base',
|
||||
'data': { 'name': 'str' } }
|
||||
Reference in New Issue
Block a user