Re: [Qemu-devel] [PATCH v10 21/25] qapi: Drop unused 'kind' for struct/enum visit

2016-02-01 Thread Markus Armbruster
Eric Blake  writes:

> 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.
>
> Signed-off-by: Eric Blake 
> Reviewed-by: Marc-André Lureau 
>
> ---
> v10: rebase to earlier changes, tweak copyright
> v9: no change
> v8: rebase to 'name' motion
> v7: new patch
[...]
> diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
> index 23ff6a9..295 100644
> --- a/qapi/qapi-visit-core.c
> +++ b/qapi/qapi-visit-core.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (C) 2012-2016 Red Hat, Inc.
>   * Copyright IBM, Corp. 2011
> + * Copyright (C) 2015 Red Hat, Inc.

Rebase mistake.  Can drop the hunk on commit.

>   *
>   * Authors:
>   *  Anthony Liguori   
[...]



[Qemu-devel] [PATCH v10 21/25] qapi: Drop unused 'kind' for struct/enum visit

2016-01-29 Thread Eric Blake
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.

Signed-off-by: Eric Blake 
Reviewed-by: Marc-André Lureau 

---
v10: rebase to earlier changes, tweak copyright
v9: no change
v8: rebase to 'name' motion
v7: new patch
---
 include/qapi/visitor.h  |  5 ++---
 include/qapi/visitor-impl.h | 11 ---
 scripts/qapi-event.py   |  2 +-
 scripts/qapi-visit.py   | 12 ++--
 qapi/qapi-visit-core.c  | 16 +++-
 hmp.c   |  2 +-
 hw/core/qdev-properties.c   |  6 ++
 hw/ppc/spapr_drc.c  |  4 ++--
 hw/virtio/virtio-balloon.c  |  4 ++--
 qapi/opts-visitor.c |  2 +-
 qapi/qapi-dealloc-visitor.c |  6 ++
 qapi/qmp-input-visitor.c|  2 +-
 qapi/qmp-output-visitor.c   |  3 +--
 qom/object.c|  8 
 vl.c|  2 +-
 15 files changed, 37 insertions(+), 48 deletions(-)

diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
index 0b5cd41..997555d 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -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);
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index 734cc13..337f999 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -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, Error **errp);

 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);
@@ -61,10 +60,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
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
index edd446b..07bcb73 100644
--- a/scripts/qapi-event.py
+++ b/scripts/qapi-event.py
@@ -63,7 +63,7 @@ def gen_event_send(name, arg_type):
 qov = qmp_output_visitor_new();
 v = qmp_output_get_visitor(qov);

-visit_start_struct(v, "%(name)s", NULL, NULL, 0, );
+visit_start_struct(v, "%(name)s", NULL, 0, );
 ''',
  name=name)
 ret += gen_err_check()
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 35505ac..308000f 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -122,7 +122,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), 
);
+visit_start_struct(v, name, (void **)obj, sizeof(%(c_name)s), );
 if (err) {