mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-09 13:15:34 +00:00
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:
parent
4a8e094958
commit
9c05496958
|
@ -17,7 +17,7 @@ from qapi.common import *
|
||||||
def build_event_send_proto(name, arg_type, boxed):
|
def build_event_send_proto(name, arg_type, boxed):
|
||||||
return 'void qapi_event_send_%(c_name)s(%(param)s)' % {
|
return 'void qapi_event_send_%(c_name)s(%(param)s)' % {
|
||||||
'c_name': c_name(name.lower()),
|
'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):
|
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
|
%(proto)s
|
||||||
{
|
{
|
||||||
QDict *qmp;
|
QDict *qmp;
|
||||||
Error *err = NULL;
|
|
||||||
QMPEventFuncEmit emit;
|
QMPEventFuncEmit emit;
|
||||||
''',
|
''',
|
||||||
proto=build_event_send_proto(name, arg_type, boxed))
|
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():
|
if not arg_type.is_implicit():
|
||||||
ret += mcgen('''
|
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())
|
name=name, c_name=arg_type.c_name())
|
||||||
else:
|
else:
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
|
|
||||||
visit_start_struct(v, "%(name)s", NULL, 0, &err);
|
visit_start_struct(v, "%(name)s", NULL, 0, &error_abort);
|
||||||
if (err) {
|
visit_type_%(c_name)s_members(v, ¶m, &error_abort);
|
||||||
goto out;
|
visit_check_struct(v, &error_abort);
|
||||||
}
|
|
||||||
visit_type_%(c_name)s_members(v, ¶m, &err);
|
|
||||||
if (!err) {
|
|
||||||
visit_check_struct(v, &err);
|
|
||||||
}
|
|
||||||
visit_end_struct(v, NULL);
|
visit_end_struct(v, NULL);
|
||||||
''',
|
''',
|
||||||
name=name, c_name=arg_type.c_name())
|
name=name, c_name=arg_type.c_name())
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
if (err) {
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_complete(v, &obj);
|
visit_complete(v, &obj);
|
||||||
qdict_put_obj(qmp, "data", obj);
|
qdict_put_obj(qmp, "data", obj);
|
||||||
''')
|
''')
|
||||||
|
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
emit(%(c_enum)s, qmp, &err);
|
emit(%(c_enum)s, qmp);
|
||||||
|
|
||||||
''',
|
''',
|
||||||
c_enum=c_enum_const(event_enum_name, name))
|
c_enum=c_enum_const(event_enum_name, name))
|
||||||
|
|
||||||
if arg_type and not arg_type.is_empty():
|
if arg_type and not arg_type.is_empty():
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
out:
|
|
||||||
visit_free(v);
|
visit_free(v);
|
||||||
''')
|
''')
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
error_propagate(errp, err);
|
|
||||||
qobject_unref(qmp);
|
qobject_unref(qmp);
|
||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
|
|
Loading…
Reference in a new issue