diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-07-03 17:56:44 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-07-03 18:38:54 +0200 |
commit | c3cd6aa0201c126eda8dc71b60e7aa259a3e79b9 (patch) | |
tree | 14d935dc6e86ccb397c4861faa297e7a883242a4 /scripts/qapi | |
parent | 1f7b9f3181ee137101cca66461c47e718b853240 (diff) | |
download | qemu-c3cd6aa0201c126eda8dc71b60e7aa259a3e79b9.zip qemu-c3cd6aa0201c126eda8dc71b60e7aa259a3e79b9.tar.gz qemu-c3cd6aa0201c126eda8dc71b60e7aa259a3e79b9.tar.bz2 |
qapi/events: add #if conditions to events
Wrap generated code with #if/#endif using an 'ifcontext' on
QAPIGenCSnippet objects.
This makes a conditional event's qapi_event_send_FOO() compile-time
conditional, but its enum QAPIEvent member remains unconditional for
now. A follow up patch "qapi-event: add 'if' condition to implicit
event enum" will improve this.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20180703155648.11933-11-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r-- | scripts/qapi/events.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 0a1afac..764ef17 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -185,8 +185,10 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): genc.add(gen_enum_lookup(self._enum_name, self._event_names)) def visit_event(self, name, info, ifcond, arg_type, boxed): - self._genh.add(gen_event_send_decl(name, arg_type, boxed)) - self._genc.add(gen_event_send(name, arg_type, boxed, self._enum_name)) + with ifcontext(ifcond, self._genh, self._genc): + self._genh.add(gen_event_send_decl(name, arg_type, boxed)) + self._genc.add(gen_event_send(name, arg_type, boxed, + self._enum_name)) self._event_names.append(name) |