summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-10-26 16:34:43 -0600
committerMarkus Armbruster <armbru@redhat.com>2015-11-02 08:30:26 +0100
commit255960dd374d4497d6ea537305f1b0d8a3433789 (patch)
tree49b56b41812702438ef9f3441c61d8efd84a86c9 /scripts
parentf9e6102b48f21e464a847a858a456c521e7a83e5 (diff)
downloadhqemu-255960dd374d4497d6ea537305f1b0d8a3433789.zip
hqemu-255960dd374d4497d6ea537305f1b0d8a3433789.tar.gz
qapi: Reserve '*List' type names for list types
Type names ending in 'List' can clash with qapi list types in generated C. We don't currently use such names. It is easier to outlaw them now than to worry about how to resolve such a clash in the future. For precedence, see commit 4dc2e69, which did the same for names ending in 'Kind' versus implicit enum types for qapi unions. Update the testsuite to match. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-5-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 3af4c2c..d53b5c4 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -390,10 +390,10 @@ def add_name(name, info, meta, implicit=False):
raise QAPIExprError(info,
"%s '%s' is already defined"
% (all_names[name], name))
- if not implicit and name.endswith('Kind'):
+ if not implicit and (name.endswith('Kind') or name.endswith('List')):
raise QAPIExprError(info,
- "%s '%s' should not end in 'Kind'"
- % (meta, name))
+ "%s '%s' should not end in '%s'"
+ % (meta, name, name[-4:]))
all_names[name] = meta
@@ -1196,9 +1196,7 @@ class QAPISchema(object):
return name
def _make_array_type(self, element_type, info):
- # TODO fooList namespace is not reserved; user can create collisions,
- # or abuse our type system with ['fooList'] for 2D array
- name = element_type + 'List'
+ name = element_type + 'List' # Use namespace reserved by add_name()
if not self.lookup_type(name):
self._def_entity(QAPISchemaArrayType(name, info, element_type))
return name
OpenPOWER on IntegriCloud