diff --git a/qemu/include/qapi/visitor-impl.h b/qemu/include/qapi/visitor-impl.h index d2a177c6..48bb36d2 100644 --- a/qemu/include/qapi/visitor-impl.h +++ b/qemu/include/qapi/visitor-impl.h @@ -72,7 +72,7 @@ struct Visitor * optional for output visitors. */ void (*start_alternate)(Visitor *v, const char *name, GenericAlternate **obj, size_t size, - bool promote_int, Error **errp); + Error **errp); /* Optional, needed for dealloc visitor */ void (*end_alternate)(Visitor *v, void **obj); diff --git a/qemu/include/qapi/visitor.h b/qemu/include/qapi/visitor.h index 5101f788..7563589c 100644 --- a/qemu/include/qapi/visitor.h +++ b/qemu/include/qapi/visitor.h @@ -415,15 +415,13 @@ void visit_end_list(Visitor *v, void **list); * the qtype of the next thing to be visited, stored in (*@obj)->type. * Other visitors will leave @obj unchanged. * - * If @promote_int, treat integers as QTYPE_FLOAT. - * * If successful, this must be paired with visit_end_alternate() with * the same @obj to clean up, even if visiting the contents of the * alternate fails. */ void visit_start_alternate(Visitor *v, const char *name, GenericAlternate **obj, size_t size, - bool promote_int, Error **errp); + Error **errp); /* * Finish visiting an alternate type. diff --git a/qemu/qapi/qapi-clone-visitor.c b/qemu/qapi/qapi-clone-visitor.c index de756bfb..ed16d3a1 100644 --- a/qemu/qapi/qapi-clone-visitor.c +++ b/qemu/qapi/qapi-clone-visitor.c @@ -70,7 +70,7 @@ static GenericList *qapi_clone_next_list(Visitor *v, GenericList *tail, static void qapi_clone_start_alternate(Visitor *v, const char *name, GenericAlternate **obj, size_t size, - bool promote_int, Error **errp) + Error **errp) { qapi_clone_start_struct(v, name, (void **)obj, size, errp); } diff --git a/qemu/qapi/qapi-dealloc-visitor.c b/qemu/qapi/qapi-dealloc-visitor.c index 3a2b94ea..f929f46e 100644 --- a/qemu/qapi/qapi-dealloc-visitor.c +++ b/qemu/qapi/qapi-dealloc-visitor.c @@ -39,7 +39,7 @@ static void qapi_dealloc_end_struct(Visitor *v, void **obj) static void qapi_dealloc_start_alternate(Visitor *v, const char *name, GenericAlternate **obj, size_t size, - bool promote_int, Error **errp) + Error **errp) { } diff --git a/qemu/qapi/qapi-visit-core.c b/qemu/qapi/qapi-visit-core.c index 4d0a9df2..3c1a0520 100644 --- a/qemu/qapi/qapi-visit-core.c +++ b/qemu/qapi/qapi-visit-core.c @@ -99,12 +99,12 @@ void visit_end_list(Visitor *v, void **obj) void visit_start_alternate(Visitor *v, const char *name, GenericAlternate **obj, size_t size, - bool promote_int, Error **errp) + Error **errp) { assert(obj && size >= sizeof(GenericAlternate)); assert(!(v->type & VISITOR_OUTPUT) || *obj); if (v->start_alternate) { - v->start_alternate(v, name, obj, size, promote_int, errp); + v->start_alternate(v, name, obj, size, errp); } } diff --git a/qemu/qapi/qobject-input-visitor.c b/qemu/qapi/qobject-input-visitor.c index 57306161..86f709dd 100644 --- a/qemu/qapi/qobject-input-visitor.c +++ b/qemu/qapi/qobject-input-visitor.c @@ -325,7 +325,7 @@ static void qobject_input_end_list(Visitor *v, void **obj) static void qobject_input_start_alternate(Visitor *v, const char *name, GenericAlternate **obj, size_t size, - bool promote_int, Error **errp) + Error **errp) { QObjectInputVisitor *qiv = to_qiv(v); QObject *qobj = qobject_input_get_object(qiv, name, false, errp); diff --git a/qemu/scripts/qapi-visit.py b/qemu/scripts/qapi-visit.py index cc447eca..bd0b7422 100644 --- a/qemu/scripts/qapi-visit.py +++ b/qemu/scripts/qapi-visit.py @@ -161,20 +161,14 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s *obj, Error def gen_visit_alternate(name, variants): - promote_int = 'true' - ret = '' - for var in variants.variants: - if var.type.alternate_qtype() == 'QTYPE_QNUM': - promote_int = 'false' - - ret += mcgen(''' + ret = mcgen(''' void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error **errp) { Error *err = NULL; visit_start_alternate(v, name, (GenericAlternate **)obj, sizeof(**obj), - %(promote_int)s, &err); + &err); if (err) { goto out; } @@ -183,7 +177,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error } switch ((*obj)->type) { ''', - c_name=c_name(name), promote_int=promote_int) + c_name=c_name(name)) for var in variants.variants: ret += mcgen('''