aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-09-14 17:35:03 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-09-24 14:07:23 +0200
commite31fe1266c7daa49bd086c45efeb5af06309c0ef (patch)
treeb7cb3b5331e5fd92281dd043d8ca20b37ac30ce5 /scripts
parent6955397677859ada5a65f430edee8035fb4e4b7c (diff)
downloadqemu-e31fe1266c7daa49bd086c45efeb5af06309c0ef.zip
qemu-e31fe1266c7daa49bd086c45efeb5af06309c0ef.tar.gz
qemu-e31fe1266c7daa49bd086c45efeb5af06309c0ef.tar.bz2
qapi: Delete useless check_exprs() code for simple union kind
Commit bceae7697f "qapi script: support enum type as discriminator in union" made check_exprs() add the implicit enum types of simple unions to global @enum_types. I'm not sure it was needed even then. It's certainly not needed now. Delete it. discriminator_find_enum_define() and add_name() parameter @implicit are now dead. Bury them. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190914153506.2151-17-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/common.py39
1 files changed, 2 insertions, 37 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 3c3154a..7e79c42 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -672,26 +672,6 @@ def find_alternate_member_qtype(qapi_type):
return None
-# Return the discriminator enum define if discriminator is specified as an
-# enum type, otherwise return None.
-def discriminator_find_enum_define(expr):
- base = expr.get('base')
- discriminator = expr.get('discriminator')
-
- if not (discriminator and base):
- return None
-
- base_members = find_base_members(base)
- if not base_members:
- return None
-
- discriminator_value = base_members.get(discriminator)
- if not discriminator_value:
- return None
-
- return enum_types.get(discriminator_value['type'])
-
-
# Names must be letters, numbers, -, and _. They must start with letter,
# except for downstream extensions which must start with __RFQDN_.
# Dots are only valid in the downstream extension prefix.
@@ -722,7 +702,7 @@ def check_name(info, source, name, allow_optional=False,
raise QAPISemError(info, "%s uses invalid name '%s'" % (source, name))
-def add_name(name, info, meta, implicit=False):
+def add_name(name, info, meta):
global all_names
check_name(info, "'%s'" % meta, name)
# FIXME should reject names that differ only in '_' vs. '.'
@@ -730,7 +710,7 @@ def add_name(name, info, meta, implicit=False):
if name in all_names:
raise QAPISemError(info, "%s '%s' is already defined"
% (all_names[name], name))
- if not implicit and (name.endswith('Kind') or name.endswith('List')):
+ if name.endswith('Kind') or name.endswith('List'):
raise QAPISemError(info, "%s '%s' should not end in '%s'"
% (meta, name, name[-4:]))
all_names[name] = meta
@@ -1138,21 +1118,6 @@ def check_exprs(exprs):
raise QAPISemError(info, "Definition of '%s' follows documentation"
" for '%s'" % (name, doc.symbol))
- # Try again for hidden UnionKind enum
- for expr_elem in exprs:
- expr = expr_elem['expr']
-
- if 'include' in expr:
- continue
- if 'union' in expr and not discriminator_find_enum_define(expr):
- name = '%sKind' % expr['union']
- elif 'alternate' in expr:
- name = '%sKind' % expr['alternate']
- else:
- continue
- enum_types[name] = {'enum': name}
- add_name(name, info, 'enum', implicit=True)
-
# Validate that exprs make sense
for expr_elem in exprs:
expr = expr_elem['expr']