diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qapi/commands.py | 4 | ||||
-rw-r--r-- | scripts/qapi/visit.py | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 0a75a9371b..b7e577a5d1 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -96,7 +96,7 @@ static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in, { Visitor *v; - v = qobject_output_visitor_new(ret_out); + v = qobject_output_visitor_new_qmp(ret_out); if (visit_type_%(c_name)s(v, "unused", &ret_in, errp)) { visit_complete(v, ret_out); } @@ -251,9 +251,9 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): visit = self._module_basename('qapi-visit', name) self._genc.add(mcgen(''' #include "qemu/osdep.h" +#include "qapi/compat-policy.h" #include "qapi/visitor.h" #include "qapi/qmp/qdict.h" -#include "qapi/qobject-output-visitor.h" #include "qapi/qobject-input-visitor.h" #include "qapi/dealloc-visitor.h" #include "qapi/error.h" diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 9aa0b1e11e..9d83bf650f 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -77,6 +77,7 @@ bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp) c_type=base.c_name()) for memb in members: + deprecated = 'deprecated' in [f.name for f in memb.features] ret += gen_if(memb.ifcond) if memb.optional: ret += mcgen(''' @@ -84,6 +85,12 @@ bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp) ''', name=memb.name, c_name=c_name(memb.name)) indent.increase() + if deprecated: + ret += mcgen(''' + if (visit_deprecated(v, "%(name)s")) { +''', + name=memb.name) + indent.increase() ret += mcgen(''' if (!visit_type_%(c_type)s(v, "%(name)s", &obj->%(c_name)s, errp)) { return false; @@ -91,6 +98,11 @@ bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp) ''', c_type=memb.type.c_name(), name=memb.name, c_name=c_name(memb.name)) + if deprecated: + indent.decrease() + ret += mcgen(''' + } +''') if memb.optional: indent.decrease() ret += mcgen(''' |