From 6069bb69a71fb38877c3dd8c4f4aba1f88e02c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 29 Jun 2018 14:19:03 -0500 Subject: [PATCH] qapi/events: generate event enum in main module The event generator produces an enum, and put it in the last visited module. It fits better in the main module, since it's the set of all visited events, from all modules. Backports commit f030ffd39d6c1ea8fff281be5e4b19c819d7ce10 from qemu --- qemu/scripts/qapi/events.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qemu/scripts/qapi/events.py b/qemu/scripts/qapi/events.py index 2c631533..d3c404d2 100644 --- a/qemu/scripts/qapi/events.py +++ b/qemu/scripts/qapi/events.py @@ -180,8 +180,9 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): types=types)) def visit_end(self): - self._genh.add(gen_enum(self._enum_name, self._event_names)) - self._genc.add(gen_enum_lookup(self._enum_name, self._event_names)) + (genc, genh) = self._module[self._main_module] + genh.add(gen_enum(self._enum_name, self._event_names)) + genc.add(gen_enum_lookup(self._enum_name, self._event_names)) def visit_event(self, name, info, arg_type, boxed): self._genh.add(gen_event_send_decl(name, arg_type, boxed))