Skip to content

Commit

Permalink
qapi: Stop enforcing "type name should not end in 'Kind'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Markus Armbruster committed Sep 25, 2021
1 parent 4cfd653 commit 8ebc312
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 8 deletions.
6 changes: 3 additions & 3 deletions scripts/qapi/expr.py
Expand Up @@ -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.
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion tests/qapi-schema/meson.build
Expand Up @@ -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',
Expand Down
2 changes: 0 additions & 2 deletions tests/qapi-schema/reserved-type-kind.err

This file was deleted.

2 changes: 0 additions & 2 deletions tests/qapi-schema/reserved-type-kind.json

This file was deleted.

Empty file.

0 comments on commit 8ebc312

Please sign in to comment.