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
This commit is contained in:
Marc-André Lureau 2018-06-29 14:19:03 -05:00 committed by Lioncash
parent e973b88d32
commit 6069bb69a7
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -180,8 +180,9 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
types=types)) types=types))
def visit_end(self): def visit_end(self):
self._genh.add(gen_enum(self._enum_name, self._event_names)) (genc, genh) = self._module[self._main_module]
self._genc.add(gen_enum_lookup(self._enum_name, self._event_names)) 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): def visit_event(self, name, info, arg_type, boxed):
self._genh.add(gen_event_send_decl(name, arg_type, boxed)) self._genh.add(gen_event_send_decl(name, arg_type, boxed))