summaryrefslogtreecommitdiffstats
path: root/scripts/qapi/introspect.py
diff options
context:
space:
mode:
authorMarc-André Lureau2018-07-03 17:56:41 +0200
committerMarkus Armbruster2018-07-03 18:38:53 +0200
commit40bb13766af789ae468a848aec7b45742497e5a9 (patch)
tree74f8b6e1b9e0de1eda454608e269535fee83b7e1 /scripts/qapi/introspect.py
parentqapi: add #if/#endif helpers (diff)
downloadqemu-40bb13766af789ae468a848aec7b45742497e5a9.tar.gz
qemu-40bb13766af789ae468a848aec7b45742497e5a9.tar.xz
qemu-40bb13766af789ae468a848aec7b45742497e5a9.zip
qapi-introspect: modify to_qlit() to append ',' on level > 0
The following patch is going to break list entries with #if/#endif, so they should have the trailing ',' as suffix. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-8-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/introspect.py')
-rw-r--r--scripts/qapi/introspect.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index 245cfdfb65..bd7e1219be 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -30,7 +30,7 @@ def to_qlit(obj, level=0, suppress_first_indent=False):
for elt in obj]
elts.append(indent(level + 1) + "{}")
ret += 'QLIT_QLIST(((QLitObject[]) {\n'
- ret += ',\n'.join(elts) + '\n'
+ ret += '\n'.join(elts) + '\n'
ret += indent(level) + '}))'
elif isinstance(obj, dict):
elts = []
@@ -45,6 +45,8 @@ def to_qlit(obj, level=0, suppress_first_indent=False):
ret += 'QLIT_QBOOL(%s)' % ('true' if obj else 'false')
else:
assert False # not implemented
+ if level > 0:
+ ret += ','
return ret