[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 02/25] qapi: Stop enforcing "type name should not end in 'Kind'
From: |
Markus Armbruster |
Subject: |
[PULL v2 02/25] qapi: Stop enforcing "type name should not end in 'Kind' |
Date: |
Mon, 27 Sep 2021 15:06:24 +0200 |
I'm about to convert simple unions to flat unions, then drop simple
union support. The conversion involves making the implict enum types
explicit. To reduce churn, I'd like to name them exactly like the
implicit types they replace. However, these names are reserved for
the generator's use. They won't be once simple unions are gone. Stop
enforcing this naming rule now rather than then.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210917143134.412106-3-armbru@redhat.com>
---
scripts/qapi/expr.py | 6 +++---
tests/qapi-schema/meson.build | 1 -
tests/qapi-schema/reserved-type-kind.err | 2 --
tests/qapi-schema/reserved-type-kind.json | 2 --
tests/qapi-schema/reserved-type-kind.out | 0
5 files changed, 3 insertions(+), 8 deletions(-)
delete mode 100644 tests/qapi-schema/reserved-type-kind.err
delete mode 100644 tests/qapi-schema/reserved-type-kind.json
delete mode 100644 tests/qapi-schema/reserved-type-kind.out
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 90bde501b0..91959ee79a 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -171,7 +171,7 @@ def check_defn_name_str(name: str, info: QAPISourceInfo,
meta: str) -> None:
- 'event' names adhere to `check_name_upper()`.
- 'command' names adhere to `check_name_lower()`.
- Else, meta is a type, and must pass `check_name_camel()`.
- These names must not end with ``Kind`` nor ``List``.
+ These names must not end with ``List``.
:param name: Name to check.
:param info: QAPI schema source file information.
@@ -187,9 +187,9 @@ def check_defn_name_str(name: str, info: QAPISourceInfo,
meta: str) -> None:
permit_underscore=name in info.pragma.command_name_exceptions)
else:
check_name_camel(name, info, meta)
- if name.endswith('Kind') or name.endswith('List'):
+ if name.endswith('List'):
raise QAPISemError(
- info, "%s name should not end in '%s'" % (meta, name[-4:]))
+ info, "%s name should not end in 'List'" % meta)
def check_keys(value: _JSONObject,
diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
index 6b2a4ce41a..0798e94042 100644
--- a/tests/qapi-schema/meson.build
+++ b/tests/qapi-schema/meson.build
@@ -168,7 +168,6 @@ schemas = [
'reserved-member-q.json',
'reserved-member-u.json',
'reserved-member-underscore.json',
- 'reserved-type-kind.json',
'reserved-type-list.json',
'returns-alternate.json',
'returns-array-bad.json',
diff --git a/tests/qapi-schema/reserved-type-kind.err
b/tests/qapi-schema/reserved-type-kind.err
deleted file mode 100644
index d8fb769f9d..0000000000
--- a/tests/qapi-schema/reserved-type-kind.err
+++ /dev/null
@@ -1,2 +0,0 @@
-reserved-type-kind.json: In enum 'UnionKind':
-reserved-type-kind.json:2: enum name should not end in 'Kind'
diff --git a/tests/qapi-schema/reserved-type-kind.json
b/tests/qapi-schema/reserved-type-kind.json
deleted file mode 100644
index 9ecaba12bc..0000000000
--- a/tests/qapi-schema/reserved-type-kind.json
+++ /dev/null
@@ -1,2 +0,0 @@
-# we reject types that would conflict with implicit union enum
-{ 'enum': 'UnionKind', 'data': [ 'oops' ] }
diff --git a/tests/qapi-schema/reserved-type-kind.out
b/tests/qapi-schema/reserved-type-kind.out
deleted file mode 100644
index e69de29bb2..0000000000
--
2.31.1
- [PULL v2 09/25] qapi: Convert simple union ImageInfoSpecific to flat one, (continued)
- [PULL v2 09/25] qapi: Convert simple union ImageInfoSpecific to flat one, Markus Armbruster, 2021/09/27
- [PULL v2 11/25] tests/qapi-schema: Prepare for simple union UserDefListUnion removal, Markus Armbruster, 2021/09/27
- [PULL v2 16/25] tests/qapi-schema: Simple union UserDefListUnion is now unused, drop, Markus Armbruster, 2021/09/27
- [PULL v2 19/25] tests/qapi-schema: Drop simple union __org.qemu_x-Union1, Markus Armbruster, 2021/09/27
- [PULL v2 05/25] qapi: Convert simple union TpmTypeOptions to flat one, Markus Armbruster, 2021/09/27
- [PULL v2 14/25] test-clone-visitor: Wean off UserDefListUnion, Markus Armbruster, 2021/09/27
- [PULL v2 17/25] tests/qapi-schema: Rewrite simple union TestIfUnion to be flat, Markus Armbruster, 2021/09/27
- [PULL v2 08/25] qapi: Convert simple union SocketAddressLegacy to flat one, Markus Armbruster, 2021/09/27
- [PULL v2 07/25] qapi: Convert simple union ChardevBackend to flat one, Markus Armbruster, 2021/09/27
- [PULL v2 03/25] qapi: Convert simple union KeyValue to flat one, Markus Armbruster, 2021/09/27
- [PULL v2 02/25] qapi: Stop enforcing "type name should not end in 'Kind',
Markus Armbruster <=
- [PULL v2 10/25] qapi: Convert simple union TransactionAction to flat one, Markus Armbruster, 2021/09/27
- [PULL v2 25/25] tests/qapi-schema: Make test-qapi.py -u work when files are absent, Markus Armbruster, 2021/09/27
- [PULL v2 18/25] test-clone-visitor: Wean off __org.qemu_x-Union1, Markus Armbruster, 2021/09/27
- [PULL v2 06/25] qapi: Convert simple union MemoryDeviceInfo to flat one, Markus Armbruster, 2021/09/27
- [PULL v2 23/25] test-clone-visitor: Correct an accidental rename, Markus Armbruster, 2021/09/27
- [PULL v2 15/25] tests/qapi-schema: Wean off UserDefListUnion, Markus Armbruster, 2021/09/27
- [PULL v2 12/25] test-qobject-input-visitor: Wean off UserDefListUnion, Markus Armbruster, 2021/09/27
- [PULL v2 21/25] qapi: Drop simple unions, Markus Armbruster, 2021/09/27
- [PULL v2 20/25] tests/qapi-schema: Purge simple unions from tests, Markus Armbruster, 2021/09/27
- [PULL v2 22/25] tests/qapi-schema: Rename flat-union-* test cases to union-*, Markus Armbruster, 2021/09/27