diff options
Diffstat (limited to 'scripts/qapi-types.py')
-rw-r--r-- | scripts/qapi-types.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 524d220ed7..1eb59b1dbb 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -180,7 +180,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor): self.decl = '' self.defn = '' self._fwdecl = '' - self._btin = guardstart('QAPI_TYPES_BUILTIN') + self._btin = '\n' + guardstart('QAPI_TYPES_BUILTIN') def visit_end(self): self.decl = self._fwdecl + self.decl @@ -254,26 +254,28 @@ for o, a in opts: blurb = ' * Schema-defined QAPI types' -(fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix, - 'qapi-types.c', 'qapi-types.h', - blurb, __doc__) +genc = QAPIGenC(blurb, __doc__) +genh = QAPIGenH(blurb, __doc__) -fdef.write(mcgen(''' +genc.add(mcgen(''' #include "qemu/osdep.h" #include "qapi/dealloc-visitor.h" #include "%(prefix)sqapi-types.h" #include "%(prefix)sqapi-visit.h" ''', - prefix=prefix)) + prefix=prefix)) -fdecl.write(mcgen(''' +genh.add(mcgen(''' #include "qapi/util.h" ''')) schema = QAPISchema(input_file) vis = QAPISchemaGenTypeVisitor() schema.visit(vis) -fdef.write(vis.defn) -fdecl.write(vis.decl) +genc.add(vis.defn) +genh.add(vis.decl) -close_output(fdef, fdecl) +if do_c: + genc.write(output_dir, prefix + 'qapi-types.c') +if do_h: + genh.write(output_dir, prefix + 'qapi-types.h') |