On Mon, Dec 07, 2015 at 08:55:18PM -0700, Eric Blake wrote: > As mentioned in previous patches, we want to call visit_end_struct() > functions unconditionally, so that visitors can release resources > tied up since the matching visit_start_struct() without also having > to worry about error priority if more than one error occurs. > > Even though error_propagate() can be safely used to ignore a second > error during cleanup caused by a first error, it is simpler if the > cleanup cannot set an error, and we instead split the task of > checking that an input visitor has no unvisited input as a new > function visit_check_struct(), called only if all prior steps are > successful. > > Generated code has diffs resembling: > > |@@ -59,10 +59,12 @@ void visit_type_ACPIOSTInfo(Visitor *v, > | goto out_obj; > | } > | visit_type_ACPIOSTInfo_fields(v, obj, &err); > |+ if (err) { > |+ goto out_obj; > |+ } > |+ visit_check_struct(v, &err); > | out_obj: > |- error_propagate(errp, err); > |- err = NULL; > |- visit_end_struct(v, &err); > |+ visit_end_struct(v); > | out: > > Signed-off-by: Eric Blake For spapr parts: Acked-by: David Gibson -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson