aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2021-03-18 16:55:13 +0100
committerMarkus Armbruster <armbru@redhat.com>2021-03-19 15:43:33 +0100
commita291a38fa1db6a67bd9046da26a48e82c591ca49 (patch)
treee1e9f45a034da6efe0db8e753e679d919048c6f6 /scripts
parent278fc2f7d3425dfbc6aa91644bffc65e94afad7c (diff)
qapi: Implement deprecated-output=hide for QMP event data
This policy suppresses deprecated bits in output, and thus permits "testing the future". Implement it for QMP event data: suppress deprecated members. No QMP event data is deprecated right now. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210318155519.1224118-6-armbru@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/events.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py
index f6e1e76f64..fee8c671e7 100644
--- a/scripts/qapi/events.py
+++ b/scripts/qapi/events.py
@@ -126,7 +126,7 @@ def gen_event_send(name: str,
if have_args:
assert arg_type is not None
ret += mcgen('''
- v = qobject_output_visitor_new(&obj);
+ v = qobject_output_visitor_new_qmp(&obj);
''')
if not arg_type.is_implicit():
ret += mcgen('''
@@ -145,7 +145,11 @@ def gen_event_send(name: str,
ret += mcgen('''
visit_complete(v, &obj);
- qdict_put_obj(qmp, "data", obj);
+ if (qdict_size(qobject_to(QDict, obj))) {
+ qdict_put_obj(qmp, "data", obj);
+ } else {
+ qobject_unref(obj);
+ }
''')
ret += mcgen('''
@@ -188,7 +192,6 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
#include "qapi/compat-policy.h"
#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
-#include "qapi/qobject-output-visitor.h"
#include "qapi/qmp-event.h"
''',