[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 25/54] qapi-visit: add #if conditions to visitors
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v2 25/54] qapi-visit: add #if conditions to visitors |
Date: |
Tue, 22 Aug 2017 15:22:26 +0200 |
Wrap generated code with #if/#endif using the ifcond_decorator.
Signed-off-by: Marc-André Lureau <address@hidden>
---
scripts/qapi-visit.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index c29c2d869e..bb18c9edee 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -267,6 +267,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):
self.decl = None
self.defn = None
self._btin = None
+ self.if_members = ['decl', 'defn', '_btin']
def visit_begin(self, schema):
self.decl = ''
@@ -282,6 +283,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):
self.decl = self._btin + self.decl
self._btin = None
+ @ifcond_decorator
def visit_enum_type(self, name, info, values, prefix, ifcond):
# Special case for our lone builtin enum type
# TODO use something cleaner than existence of info
@@ -293,6 +295,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):
self.decl += gen_visit_decl(name, scalar=True)
self.defn += gen_visit_enum(name)
+ @ifcond_decorator
def visit_array_type(self, name, info, element_type, ifcond):
decl = gen_visit_decl(name)
defn = gen_visit_list(name, element_type)
@@ -304,6 +307,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):
self.decl += decl
self.defn += defn
+ @ifcond_decorator
def visit_object_type(self, name, info, base, members, variants, ifcond):
# Nothing to do for the special empty builtin
if name == 'q_empty':
@@ -317,6 +321,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):
self.decl += gen_visit_decl(name)
self.defn += gen_visit_object(name, base, members, variants)
+ @ifcond_decorator
def visit_alternate_type(self, name, info, variants, ifcond):
self.decl += gen_visit_decl(name)
self.defn += gen_visit_alternate(name, variants)
--
2.14.1.146.gd35faa819
- [Qemu-devel] [PATCH v2 45/54] qapi: add conditions to VNC type/commands/events on the schema, (continued)
- [Qemu-devel] [PATCH v2 45/54] qapi: add conditions to VNC type/commands/events on the schema, Marc-André Lureau, 2017/08/22
- [Qemu-devel] [PATCH v2 51/54] qapi: make s390 commands depend on TARGET_S390X, Marc-André Lureau, 2017/08/22
- Re: [Qemu-devel] [PATCH v2 51/54] qapi: make s390 commands depend on TARGET_S390X, Markus Armbruster, 2017/08/22
- Re: [Qemu-devel] [PATCH v2 51/54] qapi: make s390 commands depend on TARGET_S390X, David Hildenbrand, 2017/08/22
- Re: [Qemu-devel] [PATCH v2 51/54] qapi: make s390 commands depend on TARGET_S390X, Markus Armbruster, 2017/08/22
[Qemu-devel] [PATCH v2 25/54] qapi-visit: add #if conditions to visitors,
Marc-André Lureau <=
[Qemu-devel] [PATCH v2 48/54] tests/qmp-test: add query-qmp-schema test, Marc-André Lureau, 2017/08/22
[Qemu-devel] [PATCH v2 09/54] hmp: use qapi_enum_parse() in hmp_migrate_set_parameter, Marc-André Lureau, 2017/08/22
[Qemu-devel] [PATCH v2 22/54] qapi-introspect: add preprocessor conditions to generated QLit, Marc-André Lureau, 2017/08/22
[Qemu-devel] [PATCH v2 13/54] qapi: drop the sentinel in enum array, Marc-André Lureau, 2017/08/22
[Qemu-devel] [PATCH v2 06/54] qapi: introduce qapi_enum_lookup(), Marc-André Lureau, 2017/08/22