[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 10/14] qapi/events: add #if conditions to events
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v7 10/14] qapi/events: add #if conditions to events |
Date: |
Tue, 3 Jul 2018 17:56:44 +0200 |
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 <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
scripts/qapi/events.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py
index 0a1afac134..764ef177ab 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)
--
2.18.0.rc1
- [Qemu-devel] [PATCH v7 00/14] qapi: add #if pre-processor conditions to generated code (part 1), Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 01/14] qapi: add 'if' to top-level expressions, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 02/14] qapi: pass 'if' condition into QAPISchemaEntity objects, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 05/14] qapi: mcgen() shouldn't indent # lines, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 03/14] qapi: leave the ifcond attribute undefined until check(), Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 04/14] qapi: add 'ifcond' to visitor methods, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 07/14] qapi-introspect: modify to_qlit() to append ', ' on level > 0, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 11/14] qapi-types: add #if conditions to types & visitors, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 10/14] qapi/events: add #if conditions to events,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v7 08/14] qapi-introspect: add preprocessor conditions to generated QLit, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 09/14] qapi/commands: add #if conditions to commands, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 06/14] qapi: add #if/#endif helpers, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 12/14] qapi: add 'If:' section to generated documentation, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 13/14] qapi: add conditions to VNC type/commands/events on the schema, Marc-André Lureau, 2018/07/03
- [Qemu-devel] [PATCH v7 14/14] qapi: add conditions to SPICE type/commands/events on the schema, Marc-André Lureau, 2018/07/03
- Re: [Qemu-devel] [PATCH v7 00/14] qapi: add #if pre-processor conditions to generated code (part 1), Markus Armbruster, 2018/07/03