[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 23/54] qapi-commands: add #if conditions to comma
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v2 23/54] qapi-commands: add #if conditions to commands |
Date: |
Tue, 22 Aug 2017 15:22:24 +0200 |
Wrap generated code with #if/#endif using the ifcond_decorator.
Signed-off-by: Marc-André Lureau <address@hidden>
---
scripts/qapi-commands.py | 2 ++
tests/test-qmp-commands.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 5eb96b2d95..db45415c41 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -228,6 +228,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):
self.defn = None
self._regy = None
self._visited_ret_types = None
+ self.if_members = ['decl', 'defn', '_regy']
def visit_begin(self, schema):
self.decl = ''
@@ -240,6 +241,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):
self._regy = None
self._visited_ret_types = None
+ @ifcond_decorator
def visit_command(self, name, info, arg_type, ret_type,
gen, success_response, boxed, ifcond):
if not gen:
diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
index 9b9a7ffee7..ad7b6e4e1d 100644
--- a/tests/test-qmp-commands.c
+++ b/tests/test-qmp-commands.c
@@ -10,11 +10,11 @@
static QmpCommandList qmp_commands;
-/* #if defined(TEST_IF_CMD) */
+#if defined(TEST_IF_CMD)
void qmp_TestIfCmd(TestIfStruct *foo, Error **errp)
{
}
-/* #endif */
+#endif
void qmp_user_def_cmd(Error **errp)
{
--
2.14.1.146.gd35faa819
- Re: [Qemu-devel] [PATCH v2 06/54] qapi: introduce qapi_enum_lookup(), (continued)
- [Qemu-devel] [PATCH v2 27/54] qapi-types: add #if conditions to types, Marc-André Lureau, 2017/08/22
- [Qemu-devel] [PATCH v2 49/54] build-sys: make qemu qapi objects per-target, Marc-André Lureau, 2017/08/22
- [Qemu-devel] [PATCH v2 23/54] qapi-commands: add #if conditions to commands,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v2 40/54] docs: document schema configuration, Marc-André Lureau, 2017/08/22
- [Qemu-devel] [PATCH v2 46/54] qapi: add conditions to SPICE type/commands/events on the schema, Marc-André Lureau, 2017/08/22
- [Qemu-devel] [PATCH v2 41/54] qapi2texi: add 'If:' section to generated documentation, Marc-André Lureau, 2017/08/22
- [Qemu-devel] [PATCH v2 44/54] qapi2texi: add condition to variants, Marc-André Lureau, 2017/08/22
- [Qemu-devel] [PATCH v2 47/54] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2017/08/22
- [Qemu-devel] [PATCH v2 52/54] qapi: make query-gic-capabilities depend on TARGET_ARM, Marc-André Lureau, 2017/08/22
- Re: [Qemu-devel] [PATCH v2 00/54] qapi: add #if pre-processor conditions to generated code, no-reply, 2017/08/22
- Re: [Qemu-devel] [PATCH v2 00/54] qapi: add #if pre-processor conditions to generated code, Markus Armbruster, 2017/08/23