From dcac64711ea906e844ae60a5927e5580f7252c1e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 14 Feb 2019 16:22:36 +0100 Subject: qapi: Clean up modular built-in code generation a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We neglect to call .visit_module() for the special module we use for built-ins. Harmless, but clean it up anyway. The tests/qapi-schema/*.out now show the built-in module as 'module None'. Subclasses of QAPISchemaModularCVisitor need to ._add_module() this special module to enable code generation for built-ins. When this hasn't been done, QAPISchemaModularCVisitor.visit_module() does nothing for the special module. That looks like built-ins could accidentally be generated into the wrong module when a subclass neglects to call ._add_module(). Can't happen, because built-ins are all visited before any other module. But that's non-obvious. Switch off code generation explicitly. Rename QAPISchemaModularCVisitor._begin_module() to ._begin_user_module(). New QAPISchemaModularCVisitor._is_builtin_module(), for clarity. Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Message-Id: <20190214152251.2073-4-armbru@redhat.com> --- scripts/qapi/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/qapi/commands.py') diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 0f3c991918..ebf488953d 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -242,7 +242,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): self._regy = QAPIGenCCode() self._visited_ret_types = {} - def _begin_module(self, name): + def _begin_user_module(self, name): self._visited_ret_types[self._genc] = set() commands = self._module_basename('qapi-commands', name) types = self._module_basename('qapi-types', name) -- cgit v1.2.3