[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 3/3] coccinelle: Remove unnecessary variables
Re: [Qemu-devel] [PATCH v3 3/3] coccinelle: Remove unnecessary variables for function return value
Tue, 14 Jun 2016 08:20:31 -0300
On Tue, Jun 14, 2016 at 10:57:44AM +0200, Markus Armbruster wrote:
> Eduardo Habkost <address@hidden> writes:
> > Use Coccinelle script to replace 'ret = E; return ret' with
> > 'return E'. The script will do the substitution only when the
> > function return type and variable type are the same.
> > Sending as RFC because the patch looks more intrusive than the
> > others. Probably better to split it per subsystem and let each
> > maintainer review and apply it?
> I guess you forgot to drop this paragraph. Can do it on commit to
> > Manual fixups:
> > * audio/audio.c: coding style of "read (...)" and "write (...)"
> > * block/qcow2-cluster.c: wrap line to make it shorter
> > * block/qcow2-refcount.c: change indentation of wrapped line
> > * target-tricore/op_helper.c: fix coding style of
> > "remainder|quotient"
> > * target-mips/dsp_helper.c: reverted changes because I don't
> > want to argue about checkpatch.pl
> > * ui/qemu-pixman.c: fix line indentation
> > * block/rbd.c: restore blank line between declarations and
> > statements
> > Reviewed-by: Eric Blake <address@hidden>
> > Signed-off-by: Eduardo Habkost <address@hidden>
> > diff --git a/scripts/coccinelle/return_directly.cocci
> > b/scripts/coccinelle/return_directly.cocci
> > new file mode 100644
> > index 0000000..c52f4fc
> > --- /dev/null
> > +++ b/scripts/coccinelle/return_directly.cocci
> > @@ -0,0 +1,21 @@
> > +// replace 'R = X; return R;' with 'return R;'
> > +
> > +// remove assignment
> Second comment feels redundant. Can drop on commit to error-next.
> > +@ removal @
> Rule name "removal" is not used. Can drop on commit to error-next.
Oops, both are leftovers from when I was trying to do it in two
different transformations for some reason. Can be removed.
Re: [Qemu-devel] [PATCH v3 0/3] coccinelle: Clean up error checks and return value variables, Markus Armbruster, 2016/06/14