summary refs log tree commit diff stats
path: root/scripts/qapi.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-06-26 19:25:14 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-07-24 13:35:11 +0200
commit4d2d5c41a9e8ee201cda8be8701f7f9fc92e71aa (patch)
treebf7c9f1260f68a8e9d9409fd664225e324414721 /scripts/qapi.py
parentd2f95f4d482374485234790a6fc3cca29ebb7355 (diff)
downloadfocaccia-qemu-4d2d5c41a9e8ee201cda8be8701f7f9fc92e71aa.tar.gz
focaccia-qemu-4d2d5c41a9e8ee201cda8be8701f7f9fc92e71aa.zip
qapi: Introduce a first class 'null' type
I expect the 'null' type to be useful mostly for members of alternate
types.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 84e2eb441b..8aa2775f12 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -20,6 +20,7 @@ import sys
 from ordereddict import OrderedDict
 
 builtin_types = {
+    'null':     'QTYPE_QNULL',
     'str':      'QTYPE_QSTRING',
     'int':      'QTYPE_QNUM',
     'number':   'QTYPE_QNUM',
@@ -1056,6 +1057,7 @@ class QAPISchemaType(QAPISchemaEntity):
 
     def alternate_qtype(self):
         json2qtype = {
+            'null':    'QTYPE_QNULL',
             'string':  'QTYPE_QSTRING',
             'number':  'QTYPE_QNUM',
             'int':     'QTYPE_QNUM',
@@ -1515,7 +1517,8 @@ class QAPISchema(object):
                   ('uint64', 'int',     'uint64_t'),
                   ('size',   'int',     'uint64_t'),
                   ('bool',   'boolean', 'bool'),
-                  ('any',    'value',   'QObject' + pointer_suffix)]:
+                  ('any',    'value',   'QObject' + pointer_suffix),
+                  ('null',   'null',    'QNull' + pointer_suffix)]:
             self._def_builtin_type(*t)
         self.the_empty_object_type = QAPISchemaObjectType(
             'q_empty', None, None, None, [], None)