qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/3] qapi: improve specificity of type/member descriptions


From: Daniel P . Berrangé
Subject: [PATCH v2 1/3] qapi: improve specificity of type/member descriptions
Date: Thu, 23 Feb 2023 13:40:25 +0000

When describing member types always include the context of the
containing type. Although this is often redundant, in some cases
it will help to reduce ambiguity.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/qapi/schema.py                               | 5 ++---
 tests/qapi-schema/alternate-any.err                  | 2 +-
 tests/qapi-schema/alternate-conflict-bool-string.err | 2 +-
 tests/qapi-schema/alternate-conflict-dict.err        | 2 +-
 tests/qapi-schema/alternate-conflict-enum-bool.err   | 2 +-
 tests/qapi-schema/alternate-conflict-enum-int.err    | 2 +-
 tests/qapi-schema/alternate-conflict-lists.err       | 2 +-
 tests/qapi-schema/alternate-conflict-num-string.err  | 2 +-
 tests/qapi-schema/alternate-conflict-string.err      | 2 +-
 tests/qapi-schema/alternate-nested.err               | 2 +-
 tests/qapi-schema/alternate-unknown.err              | 2 +-
 tests/qapi-schema/args-member-unknown.err            | 2 +-
 tests/qapi-schema/enum-clash-member.err              | 2 +-
 tests/qapi-schema/features-duplicate-name.err        | 2 +-
 tests/qapi-schema/struct-base-clash-deep.err         | 2 +-
 tests/qapi-schema/struct-base-clash.err              | 2 +-
 tests/qapi-schema/struct-member-name-clash.err       | 2 +-
 tests/qapi-schema/union-bad-base.err                 | 2 +-
 tests/qapi-schema/union-int-branch.err               | 2 +-
 tests/qapi-schema/union-unknown.err                  | 2 +-
 20 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index cd8661125c..6c481ab0c0 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -713,9 +713,8 @@ def describe(self, info):
                 role = 'base ' + role
             else:
                 assert False
-        elif defined_in != info.defn_name:
-            return "%s '%s' of type '%s'" % (role, self.name, defined_in)
-        return "%s '%s'" % (role, self.name)
+
+        return "%s '%s' of type '%s'" % (role, self.name, defined_in)
 
 
 class QAPISchemaEnumMember(QAPISchemaMember):
diff --git a/tests/qapi-schema/alternate-any.err 
b/tests/qapi-schema/alternate-any.err
index baeb3f66d1..6c12358a88 100644
--- a/tests/qapi-schema/alternate-any.err
+++ b/tests/qapi-schema/alternate-any.err
@@ -1,2 +1,2 @@
 alternate-any.json: In alternate 'Alt':
-alternate-any.json:2: branch 'one' cannot use built-in type 'any'
+alternate-any.json:2: branch 'one' of type 'Alt' cannot use built-in type 'any'
diff --git a/tests/qapi-schema/alternate-conflict-bool-string.err 
b/tests/qapi-schema/alternate-conflict-bool-string.err
index 59ff5efa87..d7fd625632 100644
--- a/tests/qapi-schema/alternate-conflict-bool-string.err
+++ b/tests/qapi-schema/alternate-conflict-bool-string.err
@@ -1,2 +1,2 @@
 alternate-conflict-bool-string.json: In alternate 'Alt':
-alternate-conflict-bool-string.json:2: branch 'two' can't be distinguished 
from 'one'
+alternate-conflict-bool-string.json:2: branch 'two' of type 'Alt' can't be 
distinguished from 'one'
diff --git a/tests/qapi-schema/alternate-conflict-dict.err 
b/tests/qapi-schema/alternate-conflict-dict.err
index d4970284ba..05174ab4f1 100644
--- a/tests/qapi-schema/alternate-conflict-dict.err
+++ b/tests/qapi-schema/alternate-conflict-dict.err
@@ -1,2 +1,2 @@
 alternate-conflict-dict.json: In alternate 'Alt':
-alternate-conflict-dict.json:6: branch 'two' can't be distinguished from 'one'
+alternate-conflict-dict.json:6: branch 'two' of type 'Alt' can't be 
distinguished from 'one'
diff --git a/tests/qapi-schema/alternate-conflict-enum-bool.err 
b/tests/qapi-schema/alternate-conflict-enum-bool.err
index 5f35855274..02ed66b0bf 100644
--- a/tests/qapi-schema/alternate-conflict-enum-bool.err
+++ b/tests/qapi-schema/alternate-conflict-enum-bool.err
@@ -1,2 +1,2 @@
 alternate-conflict-enum-bool.json: In alternate 'Alt':
-alternate-conflict-enum-bool.json:4: branch 'two' can't be distinguished from 
'one'
+alternate-conflict-enum-bool.json:4: branch 'two' of type 'Alt' can't be 
distinguished from 'one'
diff --git a/tests/qapi-schema/alternate-conflict-enum-int.err 
b/tests/qapi-schema/alternate-conflict-enum-int.err
index 6a6d156664..1874558f49 100644
--- a/tests/qapi-schema/alternate-conflict-enum-int.err
+++ b/tests/qapi-schema/alternate-conflict-enum-int.err
@@ -1,2 +1,2 @@
 alternate-conflict-enum-int.json: In alternate 'Alt':
-alternate-conflict-enum-int.json:4: branch 'two' can't be distinguished from 
'one'
+alternate-conflict-enum-int.json:4: branch 'two' of type 'Alt' can't be 
distinguished from 'one'
diff --git a/tests/qapi-schema/alternate-conflict-lists.err 
b/tests/qapi-schema/alternate-conflict-lists.err
index f3374ec1e7..de480dc86b 100644
--- a/tests/qapi-schema/alternate-conflict-lists.err
+++ b/tests/qapi-schema/alternate-conflict-lists.err
@@ -1,2 +1,2 @@
 alternate-conflict-lists.json: In alternate 'Alt':
-alternate-conflict-lists.json:4: branch 'two' can't be distinguished from 'one'
+alternate-conflict-lists.json:4: branch 'two' of type 'Alt' can't be 
distinguished from 'one'
diff --git a/tests/qapi-schema/alternate-conflict-num-string.err 
b/tests/qapi-schema/alternate-conflict-num-string.err
index 38c805ea1f..0d21ec590c 100644
--- a/tests/qapi-schema/alternate-conflict-num-string.err
+++ b/tests/qapi-schema/alternate-conflict-num-string.err
@@ -1,2 +1,2 @@
 alternate-conflict-num-string.json: In alternate 'Alt':
-alternate-conflict-num-string.json:2: branch 'two' can't be distinguished from 
'one'
+alternate-conflict-num-string.json:2: branch 'two' of type 'Alt' can't be 
distinguished from 'one'
diff --git a/tests/qapi-schema/alternate-conflict-string.err 
b/tests/qapi-schema/alternate-conflict-string.err
index 2fa08193db..97097cae97 100644
--- a/tests/qapi-schema/alternate-conflict-string.err
+++ b/tests/qapi-schema/alternate-conflict-string.err
@@ -1,2 +1,2 @@
 alternate-conflict-string.json: In alternate 'Alt':
-alternate-conflict-string.json:2: branch 'two' can't be distinguished from 
'one'
+alternate-conflict-string.json:2: branch 'two' of type 'Alt' can't be 
distinguished from 'one'
diff --git a/tests/qapi-schema/alternate-nested.err 
b/tests/qapi-schema/alternate-nested.err
index 3ae9cd2f11..5603aa95e3 100644
--- a/tests/qapi-schema/alternate-nested.err
+++ b/tests/qapi-schema/alternate-nested.err
@@ -1,2 +1,2 @@
 alternate-nested.json: In alternate 'Alt2':
-alternate-nested.json:4: branch 'nested' cannot use alternate type 'Alt1'
+alternate-nested.json:4: branch 'nested' of type 'Alt2' cannot use alternate 
type 'Alt1'
diff --git a/tests/qapi-schema/alternate-unknown.err 
b/tests/qapi-schema/alternate-unknown.err
index 17fec1cd17..befd207a76 100644
--- a/tests/qapi-schema/alternate-unknown.err
+++ b/tests/qapi-schema/alternate-unknown.err
@@ -1,2 +1,2 @@
 alternate-unknown.json: In alternate 'Alt':
-alternate-unknown.json:2: branch 'unknown' uses unknown type 'MissingType'
+alternate-unknown.json:2: branch 'unknown' of type 'Alt' uses unknown type 
'MissingType'
diff --git a/tests/qapi-schema/args-member-unknown.err 
b/tests/qapi-schema/args-member-unknown.err
index 96b6e5d289..b24c2ae572 100644
--- a/tests/qapi-schema/args-member-unknown.err
+++ b/tests/qapi-schema/args-member-unknown.err
@@ -1,2 +1,2 @@
 args-member-unknown.json: In command 'oops':
-args-member-unknown.json:2: parameter 'member' uses unknown type 'NoSuchType'
+args-member-unknown.json:2: parameter 'member' of type 'oops-arg' uses unknown 
type 'NoSuchType'
diff --git a/tests/qapi-schema/enum-clash-member.err 
b/tests/qapi-schema/enum-clash-member.err
index e4eb102ae2..0ede36d68e 100644
--- a/tests/qapi-schema/enum-clash-member.err
+++ b/tests/qapi-schema/enum-clash-member.err
@@ -1,2 +1,2 @@
 enum-clash-member.json: In enum 'MyEnum':
-enum-clash-member.json:3: value 'one_two' collides with value 'one-two'
+enum-clash-member.json:3: value 'one_two' of type 'MyEnum' collides with value 
'one-two' of type 'MyEnum'
diff --git a/tests/qapi-schema/features-duplicate-name.err 
b/tests/qapi-schema/features-duplicate-name.err
index 0adbee6b0a..ffd124f5b0 100644
--- a/tests/qapi-schema/features-duplicate-name.err
+++ b/tests/qapi-schema/features-duplicate-name.err
@@ -1,2 +1,2 @@
 features-duplicate-name.json: In struct 'FeatureStruct0':
-features-duplicate-name.json:1: feature 'foo' collides with feature 'foo'
+features-duplicate-name.json:1: feature 'foo' of type 'FeatureStruct0' 
collides with feature 'foo' of type 'FeatureStruct0'
diff --git a/tests/qapi-schema/struct-base-clash-deep.err 
b/tests/qapi-schema/struct-base-clash-deep.err
index 79879681d9..632f78b6c0 100644
--- a/tests/qapi-schema/struct-base-clash-deep.err
+++ b/tests/qapi-schema/struct-base-clash-deep.err
@@ -1,2 +1,2 @@
 struct-base-clash-deep.json: In struct 'Sub':
-struct-base-clash-deep.json:10: member 'name' collides with member 'name' of 
type 'Base'
+struct-base-clash-deep.json:10: member 'name' of type 'Sub' collides with 
member 'name' of type 'Base'
diff --git a/tests/qapi-schema/struct-base-clash.err 
b/tests/qapi-schema/struct-base-clash.err
index 46473947e6..1d54079c16 100644
--- a/tests/qapi-schema/struct-base-clash.err
+++ b/tests/qapi-schema/struct-base-clash.err
@@ -1,2 +1,2 @@
 struct-base-clash.json: In struct 'Sub':
-struct-base-clash.json:5: member 'name' collides with member 'name' of type 
'Base'
+struct-base-clash.json:5: member 'name' of type 'Sub' collides with member 
'name' of type 'Base'
diff --git a/tests/qapi-schema/struct-member-name-clash.err 
b/tests/qapi-schema/struct-member-name-clash.err
index 7e53a605d2..ebf66cd5b8 100644
--- a/tests/qapi-schema/struct-member-name-clash.err
+++ b/tests/qapi-schema/struct-member-name-clash.err
@@ -1,2 +1,2 @@
 struct-member-name-clash.json: In struct 'Oops':
-struct-member-name-clash.json:5: member 'a_b' collides with member 'a-b'
+struct-member-name-clash.json:5: member 'a_b' of type 'Oops' collides with 
member 'a-b' of type 'Oops'
diff --git a/tests/qapi-schema/union-bad-base.err 
b/tests/qapi-schema/union-bad-base.err
index 42b2ed1dda..9f92b35a07 100644
--- a/tests/qapi-schema/union-bad-base.err
+++ b/tests/qapi-schema/union-bad-base.err
@@ -1,2 +1,2 @@
 union-bad-base.json: In union 'TestUnion':
-union-bad-base.json:8: member 'string' of type 'TestTypeA' collides with base 
member 'string'
+union-bad-base.json:8: member 'string' of type 'TestTypeA' collides with base 
member 'string' of type 'TestUnion-base'
diff --git a/tests/qapi-schema/union-int-branch.err 
b/tests/qapi-schema/union-int-branch.err
index 8fdc81edd1..302e3976e0 100644
--- a/tests/qapi-schema/union-int-branch.err
+++ b/tests/qapi-schema/union-int-branch.err
@@ -1,2 +1,2 @@
 union-int-branch.json: In union 'TestUnion':
-union-int-branch.json:8: branch 'value1' cannot use built-in type 'int'
+union-int-branch.json:8: branch 'value1' of type 'TestUnion' cannot use 
built-in type 'int'
diff --git a/tests/qapi-schema/union-unknown.err 
b/tests/qapi-schema/union-unknown.err
index dad79beae0..e60ab9421a 100644
--- a/tests/qapi-schema/union-unknown.err
+++ b/tests/qapi-schema/union-unknown.err
@@ -1,2 +1,2 @@
 union-unknown.json: In union 'Union':
-union-unknown.json:3: branch 'unknown' uses unknown type 'MissingType'
+union-unknown.json:3: branch 'unknown' of type 'Union' uses unknown type 
'MissingType'
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]