qapi: Move duplicate collision checks to schema check()

With the recent commit 'qapi: Detect collisions in C member
names', we have two different locations for detecting clashes -
one at parse time, and another at QAPISchema*.check() time.
Remove all of the ad hoc parser checks, and delete associated
code (for example, the global check_member_clash() method is
no longer needed).

Testing this showed that the test union-bad-branch wasn't adding
much: union-clash-branches also exposes the error message when
branches collide, and we've recently fixed things to avoid an
implicit collision with max.  Likewise, the error for
enum-clash-member changes to report our new detection of
upper case in a value name, unless we modify the test to use
all lower case.

The wording of several error messages has changed, but the
change is generally an improvement rather than a regression.

No change to generated code.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1449033659-25497-15-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Eric Blake 2015-12-01 22:20:58 -07:00 committed by Markus Armbruster
parent 893e1f2c51
commit 01cfbaa4c3
14 changed files with 9 additions and 69 deletions

View file

@ -1 +1 @@
tests/qapi-schema/alternate-clash.json:7: Alternate 'Alt1' member 'a_b' clashes with 'a-b'
tests/qapi-schema/alternate-clash.json:7: 'a_b' (branch of Alt1) collides with 'a-b' (branch of Alt1)

View file

@ -1 +1 @@
tests/qapi-schema/enum-clash-member.json:2: Enum 'MyEnum' member 'ONE' clashes with 'one'
tests/qapi-schema/enum-clash-member.json:2: 'one_two' (member of MyEnum) collides with 'one-two' (member of MyEnum)

View file

@ -1,2 +1,2 @@
# we reject enums where members will clash when mapped to C enum
{ 'enum': 'MyEnum', 'data': [ 'one', 'ONE' ] }
{ 'enum': 'MyEnum', 'data': [ 'one-two', 'one_two' ] }

View file

@ -1 +1 @@
tests/qapi-schema/flat-union-clash-member.json:11: Member name 'name' of branch 'value1' clashes with base 'Base'
tests/qapi-schema/flat-union-clash-member.json:11: 'name' (member of Branch1) collides with 'name' (member of Base)

View file

@ -1 +1 @@
tests/qapi-schema/struct-base-clash-deep.json:10: Member name 'name' clashes with base 'Base'
tests/qapi-schema/struct-base-clash-deep.json:10: 'name' (member of Sub) collides with 'name' (member of Base)

View file

@ -1 +1 @@
tests/qapi-schema/struct-base-clash.json:5: Member name 'name' clashes with base 'Base'
tests/qapi-schema/struct-base-clash.json:5: 'name' (member of Sub) collides with 'name' (member of Base)

View file

@ -1 +0,0 @@
tests/qapi-schema/union-bad-branch.json:6: Union 'MyUnion' member 'ONE' clashes with 'one'

View file

@ -1 +0,0 @@
1

View file

@ -1,8 +0,0 @@
# we reject normal unions where branches would collide in C
{ 'struct': 'One',
'data': { 'string': 'str' } }
{ 'struct': 'Two',
'data': { 'number': 'int' } }
{ 'union': 'MyUnion',
'data': { 'one': 'One',
'ONE': 'Two' } }

View file

@ -1 +1 @@
tests/qapi-schema/union-clash-branches.json:4: Union 'TestUnion' member 'a_b' clashes with 'a-b'
tests/qapi-schema/union-clash-branches.json:4: 'a_b' (branch of TestUnion) collides with 'a-b' (branch of TestUnion)

View file

@ -1,5 +1,5 @@
# Union branch name collision
# Reject a union that would result in a collision in generated C names (this
# would try to generate two enum values 'TEST_UNION_KIND_A_B').
# would try to generate two members 'a_b').
{ 'union': 'TestUnion',
'data': { 'a-b': 'int', 'a_b': 'str' } }