diff options
author | Markus Armbruster <armbru@redhat.com> | 2021-03-18 16:55:12 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-03-19 15:43:33 +0100 |
commit | 278fc2f7d3425dfbc6aa91644bffc65e94afad7c (patch) | |
tree | bcc95e2dcbeb3407ab6626563b2b7a7f3596e18e /scripts/qapi | |
parent | 91fa93e516d080d440ead2ad4f88960545bd5b2c (diff) | |
download | qemu-278fc2f7d3425dfbc6aa91644bffc65e94afad7c.zip qemu-278fc2f7d3425dfbc6aa91644bffc65e94afad7c.tar.gz qemu-278fc2f7d3425dfbc6aa91644bffc65e94afad7c.tar.bz2 |
qapi: Implement deprecated-output=hide for QMP events
This policy suppresses deprecated bits in output, and thus permits
"testing the future". Implement it for QMP events: suppress
deprecated ones.
No QMP event is deprecated right now.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210318155519.1224118-5-armbru@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r-- | scripts/qapi/events.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 90d2f61..f6e1e76 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -79,6 +79,7 @@ def gen_param_var(typ: QAPISchemaObjectType) -> str: def gen_event_send(name: str, arg_type: Optional[QAPISchemaObjectType], + features: List[QAPISchemaFeature], boxed: bool, event_enum_name: str, event_emit: str) -> str: @@ -107,6 +108,14 @@ def gen_event_send(name: str, if not boxed: ret += gen_param_var(arg_type) + if 'deprecated' in [f.name for f in features]: + ret += mcgen(''' + + if (compat_policy.deprecated_output == COMPAT_POLICY_OUTPUT_HIDE) { + return; + } +''') + ret += mcgen(''' qmp = qmp_event_build_dict("%(name)s"); @@ -176,6 +185,7 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): #include "%(prefix)sqapi-emit-events.h" #include "%(events)s.h" #include "%(visit)s.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-output-visitor.h" @@ -220,7 +230,7 @@ void %(event_emit)s(%(event_enum)s event, QDict *qdict); boxed: bool) -> None: 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._genc.add(gen_event_send(name, arg_type, features, boxed, self._event_enum_name, self._event_emit_name)) # Note: we generate the enum member regardless of @ifcond, to |