qapi: Drop qapi_event_send_FOO()'s Error ** argument

The generated qapi_event_send_FOO() take an Error ** argument. They
can't actually fail, because all they do with the argument is passing it
to functions that can't fail: the QObject output visitor, and the
@qmp_emit callback, which is either monitor_qapi_event_queue() or
event_test_emit().

Drop the argument, and pass &error_abort to the QObject output visitor
and @qmp_emit instead.

Backports commit 3ab72385b21d8d66df3f5fea42097ce264dc9d6b from qemu
This commit is contained in:
Peter Xu 2018-09-25 21:11:26 -04:00 committed by Lioncash
parent 4a8e094958
commit 9c05496958
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -17,7 +17,7 @@ from qapi.common import *
def build_event_send_proto(name, arg_type, boxed):
return 'void qapi_event_send_%(c_name)s(%(param)s)' % {
'c_name': c_name(name.lower()),
'param': gen_params(arg_type, boxed, 'Error **errp')}
'param': build_params(arg_type, boxed)}
def gen_event_send_decl(name, arg_type, boxed):
@ -69,7 +69,6 @@ def gen_event_send(name, arg_type, boxed, event_enum_name):
%(proto)s
{
QDict *qmp;
Error *err = NULL;
QMPEventFuncEmit emit;
''',
proto=build_event_send_proto(name, arg_type, boxed))
@ -103,45 +102,35 @@ def gen_event_send(name, arg_type, boxed, event_enum_name):
''')
if not arg_type.is_implicit():
ret += mcgen('''
visit_type_%(c_name)s(v, "%(name)s", &arg, &err);
visit_type_%(c_name)s(v, "%(name)s", &arg, &error_abort);
''',
name=name, c_name=arg_type.c_name())
else:
ret += mcgen('''
visit_start_struct(v, "%(name)s", NULL, 0, &err);
if (err) {
goto out;
}
visit_type_%(c_name)s_members(v, &param, &err);
if (!err) {
visit_check_struct(v, &err);
}
visit_start_struct(v, "%(name)s", NULL, 0, &error_abort);
visit_type_%(c_name)s_members(v, &param, &error_abort);
visit_check_struct(v, &error_abort);
visit_end_struct(v, NULL);
''',
name=name, c_name=arg_type.c_name())
ret += mcgen('''
if (err) {
goto out;
}
visit_complete(v, &obj);
qdict_put_obj(qmp, "data", obj);
''')
ret += mcgen('''
emit(%(c_enum)s, qmp, &err);
emit(%(c_enum)s, qmp);
''',
c_enum=c_enum_const(event_enum_name, name))
if arg_type and not arg_type.is_empty():
ret += mcgen('''
out:
visit_free(v);
''')
ret += mcgen('''
error_propagate(errp, err);
qobject_unref(qmp);
}
''')