self.fname = fname
self.line = line
self.parent = parent
+ self.defn_meta = None
+ self.defn_name = None
+
+ def set_defn(self, meta, name):
+ self.defn_meta = meta
+ self.defn_name = name
def next_line(self):
info = copy.copy(self)
def loc(self):
return '%s:%d' % (self.fname, self.line)
+ def in_defn(self):
+ if self.defn_name:
+ return "%s: In %s '%s':\n" % (self.fname,
+ self.defn_meta, self.defn_name)
+ return ''
+
def include_path(self):
ret = ''
parent = self.parent
return ret
def __str__(self):
- return self.include_path() + self.loc()
+ return self.include_path() + self.in_defn() + self.loc()
class QAPIError(Exception):
normalize_if(expr)
name = expr[meta]
add_name(name, info, meta)
+ info.set_defn(meta, name)
if doc and doc.symbol != name:
raise QAPISemError(info, "Definition of '%s' follows documentation"
" for '%s'" % (name, doc.symbol))
+tests/qapi-schema/alternate-any.json: In alternate 'Alt':
tests/qapi-schema/alternate-any.json:2: Alternate 'Alt' member 'one' cannot use type 'any'
+tests/qapi-schema/alternate-array.json: In alternate 'Alt':
tests/qapi-schema/alternate-array.json:5: Member 'two' of alternate 'Alt' cannot be an array
+tests/qapi-schema/alternate-branch-if-invalid.json: In alternate 'Alt':
tests/qapi-schema/alternate-branch-if-invalid.json:2: 'if' condition ' ' makes no sense
+tests/qapi-schema/alternate-clash.json: In alternate 'Alt1':
tests/qapi-schema/alternate-clash.json:7: 'a_b' (branch of Alt1) collides with 'a-b' (branch of Alt1)
+tests/qapi-schema/alternate-conflict-bool-string.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-bool-string.json:2: Alternate 'Alt' member 'two' can't be distinguished from member 'one'
+tests/qapi-schema/alternate-conflict-dict.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-dict.json:6: Alternate 'Alt' member 'two' can't be distinguished from member 'one'
+tests/qapi-schema/alternate-conflict-enum-bool.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-enum-bool.json:4: Alternate 'Alt' member 'two' can't be distinguished from member 'one'
+tests/qapi-schema/alternate-conflict-enum-int.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-enum-int.json:4: Alternate 'Alt' member 'two' can't be distinguished from member 'one'
+tests/qapi-schema/alternate-conflict-num-string.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-num-string.json:2: Alternate 'Alt' member 'two' can't be distinguished from member 'one'
+tests/qapi-schema/alternate-conflict-string.json: In alternate 'Alt':
tests/qapi-schema/alternate-conflict-string.json:2: Alternate 'Alt' member 'two' can't be distinguished from member 'one'
+tests/qapi-schema/alternate-empty.json: In alternate 'Alt':
tests/qapi-schema/alternate-empty.json:2: Alternate 'Alt' cannot have empty 'data'
+tests/qapi-schema/alternate-invalid-dict.json: In alternate 'Alt':
tests/qapi-schema/alternate-invalid-dict.json:2: Key 'type' is missing from member 'two' of alternate 'Alt'
+tests/qapi-schema/alternate-nested.json: In alternate 'Alt2':
tests/qapi-schema/alternate-nested.json:4: Member 'nested' of alternate 'Alt2' cannot use alternate type 'Alt1'
+tests/qapi-schema/alternate-unknown.json: In alternate 'Alt':
tests/qapi-schema/alternate-unknown.json:2: Member 'unknown' of alternate 'Alt' uses unknown type 'MissingType'
+tests/qapi-schema/args-alternate.json: In command 'oops':
tests/qapi-schema/args-alternate.json:3: 'data' for command 'oops' cannot use alternate type 'Alt'
+tests/qapi-schema/args-any.json: In command 'oops':
tests/qapi-schema/args-any.json:2: 'data' for command 'oops' cannot use built-in type 'any'
+tests/qapi-schema/args-array-empty.json: In command 'oops':
tests/qapi-schema/args-array-empty.json:2: Member 'empty' of 'data' for command 'oops': array type must contain single type name
+tests/qapi-schema/args-array-unknown.json: In command 'oops':
tests/qapi-schema/args-array-unknown.json:2: Member 'array' of 'data' for command 'oops' uses unknown type 'NoSuchType'
+tests/qapi-schema/args-boxed-anon.json: In command 'foo':
tests/qapi-schema/args-boxed-anon.json:2: 'data' for command 'foo' should be a type name
+tests/qapi-schema/args-boxed-string.json: In command 'foo':
tests/qapi-schema/args-boxed-string.json:2: 'data' for command 'foo' cannot use built-in type 'str'
+tests/qapi-schema/args-int.json: In command 'oops':
tests/qapi-schema/args-int.json:2: 'data' for command 'oops' cannot use built-in type 'int'
+tests/qapi-schema/args-invalid.json: In command 'foo':
tests/qapi-schema/args-invalid.json:1: 'data' for command 'foo' should be an object or type name
+tests/qapi-schema/args-member-array-bad.json: In command 'oops':
tests/qapi-schema/args-member-array-bad.json:2: Member 'member' of 'data' for command 'oops': array type must contain single type name
+tests/qapi-schema/args-member-case.json: In command 'no-way-this-will-get-whitelisted':
tests/qapi-schema/args-member-case.json:2: 'Arg' (parameter of no-way-this-will-get-whitelisted) should not use uppercase
+tests/qapi-schema/args-member-unknown.json: In command 'oops':
tests/qapi-schema/args-member-unknown.json:2: Member 'member' of 'data' for command 'oops' uses unknown type 'NoSuchType'
+tests/qapi-schema/args-name-clash.json: In command 'oops':
tests/qapi-schema/args-name-clash.json:4: 'a_b' (parameter of oops) collides with 'a-b' (parameter of oops)
+tests/qapi-schema/args-union.json: In command 'oops':
tests/qapi-schema/args-union.json:3: 'data' for command 'oops' cannot use union type 'Uni'
+tests/qapi-schema/args-unknown.json: In command 'oops':
tests/qapi-schema/args-unknown.json:2: 'data' for command 'oops' uses unknown type 'NoSuchType'
+tests/qapi-schema/bad-base.json: In struct 'MyType':
tests/qapi-schema/bad-base.json:3: 'base' for struct 'MyType' cannot use union type 'Union'
+tests/qapi-schema/bad-data.json: In command 'oops':
tests/qapi-schema/bad-data.json:2: 'data' for command 'oops' cannot be an array
+tests/qapi-schema/base-cycle-direct.json: In struct 'Loopy':
tests/qapi-schema/base-cycle-direct.json:2: Object Loopy contains itself
+tests/qapi-schema/base-cycle-indirect.json: In struct 'Base1':
tests/qapi-schema/base-cycle-indirect.json:2: Object Base1 contains itself
+tests/qapi-schema/doc-bad-symbol.json: In command 'foo':
tests/qapi-schema/doc-bad-symbol.json:6: Definition of 'foo' follows documentation for 'food'
+tests/qapi-schema/enum-bad-member.json: In enum 'MyEnum':
tests/qapi-schema/enum-bad-member.json:2: Member of enum 'MyEnum' requires a string name
+tests/qapi-schema/enum-bad-name.json: In enum 'MyEnum':
tests/qapi-schema/enum-bad-name.json:3: Member of enum 'MyEnum' uses invalid name 'not\possible'
+tests/qapi-schema/enum-bad-prefix.json: In enum 'MyEnum':
tests/qapi-schema/enum-bad-prefix.json:2: Enum 'MyEnum' requires a string for 'prefix'
+tests/qapi-schema/enum-clash-member.json: In enum 'MyEnum':
tests/qapi-schema/enum-clash-member.json:2: 'one_two' (value of MyEnum) collides with 'one-two' (value of MyEnum)
+tests/qapi-schema/enum-dict-member-unknown.json: In enum 'MyEnum':
tests/qapi-schema/enum-dict-member-unknown.json:2: Unknown key 'bad-key' in member of enum 'MyEnum'
Valid keys are 'if', 'name'.
+tests/qapi-schema/enum-if-invalid.json: In enum 'TestIfEnum':
tests/qapi-schema/enum-if-invalid.json:2: 'if' condition must be a string or a list of strings
+tests/qapi-schema/enum-member-case.json: In enum 'NoWayThisWillGetWhitelisted':
tests/qapi-schema/enum-member-case.json:4: 'Value' (value of NoWayThisWillGetWhitelisted) should not use uppercase
+tests/qapi-schema/enum-wrong-data.json: In enum 'MyEnum':
tests/qapi-schema/enum-wrong-data.json:2: Enum 'MyEnum' requires an array for 'data'
+tests/qapi-schema/event-boxed-empty.json: In event 'FOO':
tests/qapi-schema/event-boxed-empty.json:2: Use of 'boxed' requires 'data'
+tests/qapi-schema/event-member-invalid-dict.json: In event 'EVENT_A':
tests/qapi-schema/event-member-invalid-dict.json:1: Key 'type' is missing from member 'a' of 'data' for event 'EVENT_A'
+tests/qapi-schema/event-nest-struct.json: In event 'EVENT_A':
tests/qapi-schema/event-nest-struct.json:1: Member 'a' of 'data' for event 'EVENT_A' should be a type name
+tests/qapi-schema/features-bad-type.json: In struct 'FeatureStruct0':
tests/qapi-schema/features-bad-type.json:1: Feature of struct FeatureStruct0 requires a string name
+tests/qapi-schema/features-duplicate-name.json: In struct 'FeatureStruct0':
tests/qapi-schema/features-duplicate-name.json:1: 'foo' (feature of FeatureStruct0) collides with 'foo' (feature of FeatureStruct0)
+tests/qapi-schema/features-if-invalid.json: In struct 'Stru':
tests/qapi-schema/features-if-invalid.json:2: 'if' condition must be a string or a list of strings
+tests/qapi-schema/features-missing-name.json: In struct 'FeatureStruct0':
tests/qapi-schema/features-missing-name.json:1: Key 'name' is missing from feature of struct FeatureStruct0
+tests/qapi-schema/features-name-bad-type.json: In struct 'FeatureStruct0':
tests/qapi-schema/features-name-bad-type.json:1: Feature of struct FeatureStruct0 requires a string name
+tests/qapi-schema/features-no-list.json: In struct 'FeatureStruct0':
tests/qapi-schema/features-no-list.json:1: Struct 'FeatureStruct0' requires an array for 'features'
+tests/qapi-schema/features-unknown-key.json: In struct 'FeatureStruct0':
tests/qapi-schema/features-unknown-key.json:1: Unknown key 'colour' in feature of struct FeatureStruct0
Valid keys are 'if', 'name'.
+tests/qapi-schema/flat-union-array-branch.json: In union 'TestUnion':
tests/qapi-schema/flat-union-array-branch.json:8: Member 'value1' of union 'TestUnion' cannot be an array
+tests/qapi-schema/flat-union-bad-base.json: In union 'TestUnion':
tests/qapi-schema/flat-union-bad-base.json:8: 'string' (member of TestTypeA) collides with 'string' (base of TestUnion)
+tests/qapi-schema/flat-union-bad-discriminator.json: In union 'TestUnion':
tests/qapi-schema/flat-union-bad-discriminator.json:11: Discriminator of flat union 'TestUnion' requires a string name
+tests/qapi-schema/flat-union-base-any.json: In union 'TestUnion':
tests/qapi-schema/flat-union-base-any.json:8: 'base' for union 'TestUnion' cannot use built-in type 'any'
+tests/qapi-schema/flat-union-base-union.json: In union 'TestUnion':
tests/qapi-schema/flat-union-base-union.json:14: 'base' for union 'TestUnion' cannot use union type 'UnionBase'
+tests/qapi-schema/flat-union-clash-member.json: In union 'TestUnion':
tests/qapi-schema/flat-union-clash-member.json:11: 'name' (member of Branch1) collides with 'name' (member of Base)
+tests/qapi-schema/flat-union-discriminator-bad-name.json: In union 'MyUnion':
tests/qapi-schema/flat-union-discriminator-bad-name.json:7: Discriminator of flat union 'MyUnion' does not allow optional name '*switch'
+tests/qapi-schema/flat-union-empty.json: In union 'Union':
tests/qapi-schema/flat-union-empty.json:4: Union 'Union' has no branches
+tests/qapi-schema/flat-union-inline-invalid-dict.json: In union 'TestUnion':
tests/qapi-schema/flat-union-inline-invalid-dict.json:7: Key 'type' is missing from member 'value1' of union 'TestUnion'
+tests/qapi-schema/flat-union-inline.json: In union 'TestUnion':
tests/qapi-schema/flat-union-inline.json:7: Member 'value1' of union 'TestUnion' should be a type name
+tests/qapi-schema/flat-union-int-branch.json: In union 'TestUnion':
tests/qapi-schema/flat-union-int-branch.json:8: Member 'value1' of union 'TestUnion' cannot use built-in type 'int'
+tests/qapi-schema/flat-union-invalid-branch-key.json: In union 'TestUnion':
tests/qapi-schema/flat-union-invalid-branch-key.json:13: Discriminator value 'value_wrong' is not found in enum 'TestEnum'
+tests/qapi-schema/flat-union-invalid-discriminator.json: In union 'TestUnion':
tests/qapi-schema/flat-union-invalid-discriminator.json:10: Discriminator 'enum_wrong' is not a member of 'base'
+tests/qapi-schema/flat-union-invalid-if-discriminator.json: In union 'TestUnion':
tests/qapi-schema/flat-union-invalid-if-discriminator.json:10: The discriminator 'enum1' for union TestUnion must not be conditional
+tests/qapi-schema/flat-union-no-base.json: In union 'TestUnion':
tests/qapi-schema/flat-union-no-base.json:9: Flat union 'TestUnion' must have a base
+tests/qapi-schema/flat-union-optional-discriminator.json: In union 'MyUnion':
tests/qapi-schema/flat-union-optional-discriminator.json:7: Discriminator 'switch' is not a member of 'base'
+tests/qapi-schema/flat-union-string-discriminator.json: In union 'TestUnion':
tests/qapi-schema/flat-union-string-discriminator.json:13: Discriminator 'kind' must be of enumeration type
+tests/qapi-schema/nested-struct-data-invalid-dict.json: In command 'foo':
tests/qapi-schema/nested-struct-data-invalid-dict.json:2: Key 'type' is missing from member 'a' of 'data' for command 'foo'
+tests/qapi-schema/nested-struct-data.json: In command 'foo':
tests/qapi-schema/nested-struct-data.json:2: Member 'a' of 'data' for command 'foo' should be a type name
+tests/qapi-schema/reserved-enum-q.json: In enum 'Foo':
tests/qapi-schema/reserved-enum-q.json:4: Member of enum 'Foo' uses invalid name 'q-Unix'
+tests/qapi-schema/reserved-member-has.json: In command 'oops':
tests/qapi-schema/reserved-member-has.json:5: Member of 'data' for command 'oops' uses reserved name 'has-a'
+tests/qapi-schema/reserved-member-q.json: In struct 'Foo':
tests/qapi-schema/reserved-member-q.json:4: Member of 'data' for struct 'Foo' uses invalid name 'q-unix'
+tests/qapi-schema/reserved-member-u.json: In struct 'Oops':
tests/qapi-schema/reserved-member-u.json:7: Member of 'data' for struct 'Oops' uses reserved name 'u'
+tests/qapi-schema/reserved-member-underscore.json: In struct 'Oops':
tests/qapi-schema/reserved-member-underscore.json:4: Member of 'data' for struct 'Oops' uses invalid name '_oops'
+tests/qapi-schema/returns-alternate.json: In command 'oops':
tests/qapi-schema/returns-alternate.json:3: 'returns' for command 'oops' cannot use alternate type 'Alt'
+tests/qapi-schema/returns-array-bad.json: In command 'oops':
tests/qapi-schema/returns-array-bad.json:2: 'returns' for command 'oops': array type must contain single type name
+tests/qapi-schema/returns-dict.json: In command 'oops':
tests/qapi-schema/returns-dict.json:2: 'returns' for command 'oops' should be a type name
+tests/qapi-schema/returns-unknown.json: In command 'oops':
tests/qapi-schema/returns-unknown.json:2: 'returns' for command 'oops' uses unknown type 'NoSuchType'
+tests/qapi-schema/returns-whitelist.json: In command 'no-way-this-will-get-whitelisted':
tests/qapi-schema/returns-whitelist.json:14: 'returns' for command 'no-way-this-will-get-whitelisted' cannot use built-in type 'int'
+tests/qapi-schema/struct-base-clash-deep.json: In struct 'Sub':
tests/qapi-schema/struct-base-clash-deep.json:10: 'name' (member of Sub) collides with 'name' (member of Base)
+tests/qapi-schema/struct-base-clash.json: In struct 'Sub':
tests/qapi-schema/struct-base-clash.json:5: 'name' (member of Sub) collides with 'name' (member of Base)
+tests/qapi-schema/struct-data-invalid.json: In struct 'foo':
tests/qapi-schema/struct-data-invalid.json:1: 'data' for struct 'foo' should be an object or type name
+tests/qapi-schema/struct-member-if-invalid.json: In struct 'Stru':
tests/qapi-schema/struct-member-if-invalid.json:2: 'if' condition must be a string or a list of strings
+tests/qapi-schema/struct-member-invalid-dict.json: In struct 'foo':
tests/qapi-schema/struct-member-invalid-dict.json:2: Key 'type' is missing from member '*a' of 'data' for struct 'foo'
+tests/qapi-schema/struct-member-invalid.json: In struct 'foo':
tests/qapi-schema/struct-member-invalid.json:1: Member 'a' of 'data' for struct 'foo' should be a type name
+tests/qapi-schema/union-base-empty.json: In union 'TestUnion':
tests/qapi-schema/union-base-empty.json:5: Discriminator 'type' is not a member of 'base'
+tests/qapi-schema/union-base-no-discriminator.json: In union 'TestUnion':
tests/qapi-schema/union-base-no-discriminator.json:11: Simple union 'TestUnion' must not have a base
+tests/qapi-schema/union-branch-case.json: In union 'NoWayThisWillGetWhitelisted':
tests/qapi-schema/union-branch-case.json:2: 'Branch' (branch of NoWayThisWillGetWhitelisted) should not use uppercase
+tests/qapi-schema/union-branch-if-invalid.json: In union 'Uni':
tests/qapi-schema/union-branch-if-invalid.json:4: 'if' condition '' makes no sense
+tests/qapi-schema/union-branch-invalid-dict.json: In union 'UnionInvalidBranch':
tests/qapi-schema/union-branch-invalid-dict.json:2: Key 'type' is missing from member 'integer' of union 'UnionInvalidBranch'
+tests/qapi-schema/union-clash-branches.json: In union 'TestUnion':
tests/qapi-schema/union-clash-branches.json:4: 'a_b' (branch of TestUnion) collides with 'a-b' (branch of TestUnion)
+tests/qapi-schema/union-empty.json: In union 'Union':
tests/qapi-schema/union-empty.json:2: Union 'Union' has no branches
+tests/qapi-schema/union-invalid-base.json: In union 'TestUnion':
tests/qapi-schema/union-invalid-base.json:8: 'base' for union 'TestUnion' cannot use built-in type 'int'
+tests/qapi-schema/union-optional-branch.json: In union 'Union':
tests/qapi-schema/union-optional-branch.json:2: Member of union 'Union' does not allow optional name '*a'
+tests/qapi-schema/union-unknown.json: In union 'Union':
tests/qapi-schema/union-unknown.json:2: Member 'unknown' of union 'Union' uses unknown type 'MissingType'