Wrap generated code with #if/#endif using the ifcond_decorator. Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- 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 669aef1eb7..8af8d913b9 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, ifcond, arg_type, ret_type, gen, success_response, boxed): 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.16.0.rc1.1.gef27df75a1