aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-09-16 13:06:24 +0200
committerMarkus Armbruster <armbru@redhat.com>2015-09-21 09:56:49 +0200
commit28770e057f265a4e70bcbdfc2447cce7b5f2dc19 (patch)
treee0da3cb258bdbb19e46ab4868cd887dd064ee3db /scripts
parent6c2f9a15dfc8c18ba94defb0f819109902a817cb (diff)
downloadqemu-28770e057f265a4e70bcbdfc2447cce7b5f2dc19.zip
qemu-28770e057f265a4e70bcbdfc2447cce7b5f2dc19.tar.gz
qemu-28770e057f265a4e70bcbdfc2447cce7b5f2dc19.tar.bz2
qapi: Introduce a first class 'any' type
It's first class, because unlike '**', it actually works, i.e. doesn't require 'gen': false. '**' will go away next. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-types.py1
-rw-r--r--scripts/qapi.py9
2 files changed, 7 insertions, 3 deletions
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index d1fee20..b292682 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -327,6 +327,7 @@ fdef.write(mcgen('''
fdecl.write(mcgen('''
#include <stdbool.h>
#include <stdint.h>
+#include "qapi/qmp/qobject.h"
'''))
schema = QAPISchema(input_file)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 6b6f1ae..6a21bd6 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -33,6 +33,7 @@ builtin_types = {
'uint32': 'QTYPE_QINT',
'uint64': 'QTYPE_QINT',
'size': 'QTYPE_QINT',
+ 'any': None, # any qtype_code possible, actually
}
# Whitelist of commands allowed to return a non-dictionary
@@ -1102,8 +1103,7 @@ class QAPISchema(object):
def _def_builtin_type(self, name, json_type, c_type, c_null):
self._def_entity(QAPISchemaBuiltinType(name, json_type,
c_type, c_null))
- if name != '**':
- self._make_array_type(name) # TODO really needed?
+ self._make_array_type(name) # TODO really needed?
def _def_predefineds(self):
for t in [('str', 'string', 'char' + pointer_suffix, 'NULL'),
@@ -1119,8 +1119,9 @@ class QAPISchema(object):
('uint64', 'int', 'uint64_t', '0'),
('size', 'int', 'uint64_t', '0'),
('bool', 'boolean', 'bool', 'false'),
- ('**', 'value', None, None)]:
+ ('any', 'value', 'QObject' + pointer_suffix, 'NULL')]:
self._def_builtin_type(*t)
+ self._entity_dict['**'] = self.lookup_type('any') # TODO drop this alias
def _make_implicit_enum_type(self, name, values):
name = name + 'Kind'
@@ -1270,6 +1271,8 @@ class QAPISchema(object):
def visit(self, visitor):
visitor.visit_begin(self)
for name in sorted(self._entity_dict.keys()):
+ if self._entity_dict[name].name != name:
+ continue # ignore alias TODO drop alias and remove
self._entity_dict[name].visit(visitor)
visitor.visit_end()