Hi On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake <ebl...@redhat.com> wrote: > For empty structs, such as the 'Abort' helper type used as part > of the 'transaction' command, we were emitting a no-op > visit_type_FOO_fields(). Optimize things to instead omit calls > for empty structs. Generated code changes resemble: > > |-static void visit_type_Abort_fields(Visitor *v, Abort **obj, Error **errp) > |-{ > |- Error *err = NULL; > |- > |- error_propagate(errp, err); > |-} > |- > | void visit_type_Abort(Visitor *v, const char *name, Abort **obj, Error > **errp) > | { > | Error *err = NULL; > |@@ -112,7 +105,6 @@ void visit_type_Abort(Visitor *v, Abort > | if (!*obj) { > | goto out_obj; > | } > |- visit_type_Abort_fields(v, obj, &err); > | out_obj: > | error_propagate(errp, err); > > Another reason for doing this optimization is that it gets us > closer to merging the code for visiting structs and unions: > since flat unions have no local members, they do not need to > have a visit_type_UNION_fields() emitted, even when they start > sharing the code used to visit structs. > > Signed-off-by: Eric Blake <ebl...@redhat.com> >
Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> -- Marc-André Lureau