mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-03 16:35:46 +00:00
qapi: Drop unused 'kind' for struct/enum visit
visit_start_struct() and visit_type_enum() had a 'kind' argument that was usually set to either the stringized version of the corresponding qapi type name, or to NULL (although some clients didn't even get that right). But nothing ever used the argument. It's even hard to argue that it would be useful in a debugger, as a stack backtrace also tells which type is being visited. Therefore, drop the 'kind' argument as dead. Backports commit 337283dffbb5ad5860ed00408a5fd0665c21be07 from qemu
This commit is contained in:
parent
844c136945
commit
1f54314cbb
|
@ -33,7 +33,7 @@ void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays
|
|||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_start_struct(v, name, (void **)obj, "DummyForceArrays", sizeof(DummyForceArrays), &err);
|
||||
visit_start_struct(v, name, (void **)obj, sizeof(DummyForceArrays), &err);
|
||||
|
||||
if (err) {
|
||||
goto out;
|
||||
|
@ -53,14 +53,14 @@ out:
|
|||
void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, name, &value, QType_lookup, "QType", errp);
|
||||
visit_type_enum(v, name, &value, QType_lookup, errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, name, &value, QapiErrorClass_lookup, "QapiErrorClass", errp);
|
||||
visit_type_enum(v, name, &value, QapiErrorClass_lookup, errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ void visit_type_X86CPUFeatureWordInfo(Visitor *v, const char *name, X86CPUFeatur
|
|||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_start_struct(v, name, (void **)obj, "X86CPUFeatureWordInfo", sizeof(X86CPUFeatureWordInfo), &err);
|
||||
visit_start_struct(v, name, (void **)obj, sizeof(X86CPUFeatureWordInfo), &err);
|
||||
|
||||
if (err) {
|
||||
goto out;
|
||||
|
@ -139,7 +139,7 @@ out:
|
|||
void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, name, &value, X86CPURegister32_lookup, "X86CPURegister32", errp);
|
||||
visit_type_enum(v, name, &value, X86CPURegister32_lookup, errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Visitor
|
|||
{
|
||||
/* Must be set */
|
||||
void (*start_struct)(Visitor *v, const char *name, void **obj,
|
||||
const char *kind, size_t size, Error **errp);
|
||||
size_t size, Error **errp);
|
||||
void (*end_struct)(Visitor *v, Error **errp);
|
||||
|
||||
void (*start_implicit_struct)(Visitor *v, void **obj, size_t size,
|
||||
|
@ -31,8 +31,7 @@ struct Visitor
|
|||
void (*end_list)(Visitor *v);
|
||||
|
||||
void (*type_enum)(Visitor *v, const char *name, int *obj,
|
||||
const char *const strings[], const char *kind,
|
||||
Error **errp);
|
||||
const char *const strings[], Error **errp);
|
||||
/* May be NULL; only needed for input visitors. */
|
||||
void (*get_next_type)(Visitor *v, const char *name, QType *type,
|
||||
bool promote_int, Error **errp);
|
||||
|
@ -60,10 +59,8 @@ struct Visitor
|
|||
};
|
||||
|
||||
void input_type_enum(Visitor *v, const char *name, int *obj,
|
||||
const char * const strings[],
|
||||
const char *kind, Error **errp);
|
||||
const char *const strings[], Error **errp);
|
||||
void output_type_enum(Visitor *v, const char *name, int *obj,
|
||||
const char * const strings[],
|
||||
const char *kind, Error **errp);
|
||||
const char *const strings[], Error **errp);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef struct GenericList
|
|||
} GenericList;
|
||||
|
||||
void visit_start_struct(Visitor *v, const char *name, void **obj,
|
||||
const char *kind, size_t size, Error **errp);
|
||||
size_t size, Error **errp);
|
||||
void visit_end_struct(Visitor *v, Error **errp);
|
||||
void visit_start_implicit_struct(Visitor *v, void **obj, size_t size,
|
||||
Error **errp);
|
||||
|
@ -54,8 +54,7 @@ bool visit_optional(Visitor *v, const char *name, bool *present);
|
|||
void visit_get_next_type(Visitor *v, const char *name, QType *type,
|
||||
bool promote_int, Error **errp);
|
||||
void visit_type_enum(Visitor *v, const char *name, int *obj,
|
||||
const char *const strings[], const char *kind,
|
||||
Error **errp);
|
||||
const char *const strings[], Error **errp);
|
||||
void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp);
|
||||
void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
|
||||
Error **errp);
|
||||
|
|
|
@ -61,8 +61,7 @@ static void *qapi_dealloc_pop(QapiDeallocVisitor *qov)
|
|||
}
|
||||
|
||||
static void qapi_dealloc_start_struct(Visitor *v, const char *name, void **obj,
|
||||
const char *kind, size_t unused,
|
||||
Error **errp)
|
||||
size_t unused, Error **errp)
|
||||
{
|
||||
QapiDeallocVisitor *qov = to_qov(v);
|
||||
qapi_dealloc_push(qov, obj);
|
||||
|
@ -170,8 +169,7 @@ static void qapi_dealloc_type_size(Visitor *v, const char *name, uint64_t *obj,
|
|||
}
|
||||
|
||||
static void qapi_dealloc_type_enum(Visitor *v, const char *name, int *obj,
|
||||
const char * const strings[],
|
||||
const char *kind, Error **errp)
|
||||
const char * const strings[], Error **errp)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#include "qapi/visitor-impl.h"
|
||||
|
||||
void visit_start_struct(Visitor *v, const char *name, void **obj,
|
||||
const char *kind, size_t size, Error **errp)
|
||||
size_t size, Error **errp)
|
||||
{
|
||||
v->start_struct(v, name, obj, kind, size, errp);
|
||||
v->start_struct(v, name, obj, size, errp);
|
||||
}
|
||||
|
||||
void visit_end_struct(Visitor *v, Error **errp)
|
||||
|
@ -86,10 +86,9 @@ void visit_get_next_type(Visitor *v, const char *name, QType *type,
|
|||
}
|
||||
|
||||
void visit_type_enum(Visitor *v, const char *name, int *obj,
|
||||
const char *const strings[], const char *kind,
|
||||
Error **errp)
|
||||
const char *const strings[], Error **errp)
|
||||
{
|
||||
v->type_enum(v, name, obj, strings, kind, errp);
|
||||
v->type_enum(v, name, obj, strings, errp);
|
||||
}
|
||||
|
||||
void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp)
|
||||
|
@ -220,8 +219,7 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp)
|
|||
}
|
||||
|
||||
void output_type_enum(Visitor *v, const char *name, int *obj,
|
||||
const char *const strings[], const char *kind,
|
||||
Error **errp)
|
||||
const char *const strings[], Error **errp)
|
||||
{
|
||||
int i = 0;
|
||||
int value = *obj;
|
||||
|
@ -239,8 +237,7 @@ void output_type_enum(Visitor *v, const char *name, int *obj,
|
|||
}
|
||||
|
||||
void input_type_enum(Visitor *v, const char *name, int *obj,
|
||||
const char *const strings[], const char *kind,
|
||||
Error **errp)
|
||||
const char *const strings[], Error **errp)
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
int64_t value = 0;
|
||||
|
|
|
@ -116,7 +116,7 @@ static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp)
|
|||
}
|
||||
|
||||
static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
|
||||
const char *kind, size_t size, Error **errp)
|
||||
size_t size, Error **errp)
|
||||
{
|
||||
QmpInputVisitor *qiv = to_qiv(v);
|
||||
QObject *qobj = qmp_input_get_object(qiv, name, true);
|
||||
|
|
|
@ -109,8 +109,7 @@ static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name,
|
|||
}
|
||||
|
||||
static void qmp_output_start_struct(Visitor *v, const char *name, void **obj,
|
||||
const char *kind, size_t unused,
|
||||
Error **errp)
|
||||
size_t unused, Error **errp)
|
||||
{
|
||||
QmpOutputVisitor *qov = to_qov(v);
|
||||
QDict *dict = qdict_new();
|
||||
|
|
|
@ -63,7 +63,7 @@ def gen_event_send(name, arg_type):
|
|||
|
||||
v = qmp_output_get_visitor(qov);
|
||||
|
||||
visit_start_struct(v, "%(name)s", NULL, NULL, 0, &err);
|
||||
visit_start_struct(v, "%(name)s", NULL, 0, &err);
|
||||
''',
|
||||
name=name)
|
||||
ret += gen_err_check()
|
||||
|
|
|
@ -119,7 +119,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error
|
|||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_start_struct(v, name, (void **)obj, "%(name)s", sizeof(%(c_name)s), &err);
|
||||
visit_start_struct(v, name, (void **)obj, sizeof(%(c_name)s), &err);
|
||||
|
||||
if (err) {
|
||||
goto out;
|
||||
|
@ -136,7 +136,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
''',
|
||||
name=name, c_name=c_name(name))
|
||||
c_name=c_name(name))
|
||||
return ret
|
||||
|
||||
|
||||
|
@ -180,11 +180,11 @@ def gen_visit_enum(name):
|
|||
void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, name, &value, %(c_name)s_lookup, "%(name)s", errp);
|
||||
visit_type_enum(v, name, &value, %(c_name)s_lookup, errp);
|
||||
*obj = value;
|
||||
}
|
||||
''',
|
||||
c_name=c_name(name), name=name)
|
||||
c_name=c_name(name))
|
||||
|
||||
|
||||
def gen_visit_alternate(name, variants):
|
||||
|
@ -256,7 +256,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error
|
|||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_start_struct(v, name, (void **)obj, "%(name)s", sizeof(%(c_name)s), &err);
|
||||
visit_start_struct(v, name, (void **)obj, sizeof(%(c_name)s), &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error
|
|||
goto out_obj;
|
||||
}
|
||||
''',
|
||||
c_name=c_name(name), name=name)
|
||||
c_name=c_name(name))
|
||||
|
||||
if base:
|
||||
ret += mcgen('''
|
||||
|
|
Loading…
Reference in a new issue