qapi: Check for member name conflicts with a base class
commitff55d72eaf9628e7d58e7b067b361cdbf789c9f4
authorEric Blake <eblake@redhat.com>
Mon, 4 May 2015 15:05:37 +0000 (4 09:05 -0600)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 5 May 2015 16:39:02 +0000 (5 18:39 +0200)
tree39ff570f5e091ca43323e7270f80bb9176a9907f
parenta7f5966b297330f6492020019544ae87c45d699b
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>
14 files changed:
scripts/qapi.py
tests/Makefile
tests/qapi-schema/flat-union-branch-clash.err
tests/qapi-schema/flat-union-branch-clash.exit
tests/qapi-schema/flat-union-branch-clash.json
tests/qapi-schema/flat-union-branch-clash.out [copied from tests/qapi-schema/flat-union-branch-clash.err with 100% similarity]
tests/qapi-schema/struct-base-clash-deep.err [new file with mode: 0644]
tests/qapi-schema/struct-base-clash-deep.exit [new file with mode: 0644]
tests/qapi-schema/struct-base-clash-deep.json [new file with mode: 0644]
tests/qapi-schema/struct-base-clash-deep.out [copied from tests/qapi-schema/flat-union-branch-clash.err with 100% similarity]
tests/qapi-schema/struct-base-clash.err [new file with mode: 0644]
tests/qapi-schema/struct-base-clash.exit [new file with mode: 0644]
tests/qapi-schema/struct-base-clash.json [new file with mode: 0644]
tests/qapi-schema/struct-base-clash.out [copied from tests/qapi-schema/flat-union-branch-clash.err with 100% similarity]