aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-11-20 19:25:48 +0100
committerMarkus Armbruster <armbru@redhat.com>2020-01-14 11:01:58 +0100
commit00ca24ff9e5fc3c6ae608226908e6864ad8193a8 (patch)
treebafb9fbc9b4fd8961e264b9580c5d4f68162343c /scripts/qapi
parent0cc0e2689498e2b731330980b1cecb83987b1bc8 (diff)
downloadqemu-00ca24ff9e5fc3c6ae608226908e6864ad8193a8.zip
qemu-00ca24ff9e5fc3c6ae608226908e6864ad8193a8.tar.gz
qemu-00ca24ff9e5fc3c6ae608226908e6864ad8193a8.tar.bz2
qapi: Generate command registration stuff into separate files
Having to include qapi-commands.h just for qmp_init_marshal() is suboptimal. Generate it into separate files. This lets monitor/misc.c, qga/main.c, and the generated qapi-commands-FOO.h include less. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-4-armbru@redhat.com> [Typos in docs/devel/qapi-code-gen.txt fixed] Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r--scripts/qapi/commands.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index ab98e50..47f4a18 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -263,18 +263,25 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
commands=commands, visit=visit))
self._genh.add(mcgen('''
#include "%(types)s.h"
-#include "qapi/qmp/dispatch.h"
''',
types=types))
def visit_end(self):
- (genc, genh) = self._module[self._main_module]
- genh.add(mcgen('''
+ self._add_system_module('init', ' * QAPI Commands initialization')
+ self._genh.add(mcgen('''
+#include "qapi/qmp/dispatch.h"
+
void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds);
''',
c_prefix=c_name(self._prefix, protect=False)))
- genc.add(gen_registry(self._regy.get_content(), self._prefix))
+ self._genc.preamble_add(mcgen('''
+#include "qemu/osdep.h"
+#include "%(prefix)sqapi-commands.h"
+#include "%(prefix)sqapi-init-commands.h"
+''',
+ prefix=self._prefix))
+ self._genc.add(gen_registry(self._regy.get_content(), self._prefix))
def visit_command(self, name, info, ifcond, arg_type, ret_type, gen,
success_response, boxed, allow_oob, allow_preconfig,