qapi: use explicitly internal module names
authorJohn Snow <jsnow@redhat.com>
Mon, 1 Feb 2021 19:37:38 +0000 (14:37 -0500)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 8 Feb 2021 13:15:58 +0000 (14:15 +0100)
QAPISchemaModularCVisitor._add_system_module() prefixes './' to its name
argument to make it a module name.  Pass the module name instead.  This
will allow us to coalesce the methods to add modules later on.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210201193747.2169670-8-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message reworded]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi/commands.py
scripts/qapi/events.py
scripts/qapi/gen.py

index 71744f48a3530c0309e9a35aa3bc5724fd51eb01..fc5fe27c47201b239951d357beadac554df7d7f7 100644 (file)
@@ -286,7 +286,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
                              types=types))
 
     def visit_end(self) -> None:
-        self._add_system_module('init', ' * QAPI Commands initialization')
+        self._add_system_module('./init', ' * QAPI Commands initialization')
         self._genh.add(mcgen('''
 #include "qapi/qmp/dispatch.h"
 
index 9851653b9d110c0827c769868ee57bc9bfb48e9b..26faa829898a17b808c48505e89d74e7f9250098 100644 (file)
@@ -191,7 +191,7 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
                              types=types))
 
     def visit_end(self) -> None:
-        self._add_system_module('emit', ' * QAPI Events emission')
+        self._add_system_module('./emit', ' * QAPI Events emission')
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
 #include "%(prefix)sqapi-emit-events.h"
index aaed78eed5ef296fdfc7d7411cccb45638b34654..da9d4d2d373231893eb75adc63f82a55ebe03f95 100644 (file)
@@ -285,7 +285,8 @@ class QAPISchemaModularCVisitor(QAPISchemaVisitor):
         self._add_module(name, blurb)
 
     def _add_system_module(self, name: Optional[str], blurb: str) -> None:
-        self._add_module(name and './' + name, blurb)
+        assert QAPISchemaModule.is_system_module(name)
+        self._add_module(name, blurb)
 
     def write(self, output_dir: str, opt_builtins: bool = False) -> None:
         for name in self._module: