Received: from eggs.gnu.org ([2001:4830:134:3::10]:50038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCmOb-0007Ya-8i for qemu-devel@nongnu.org; Tue, 14 Jun 2016 07:20:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCmOX-0007PA-OO for qemu-devel@nongnu.org; Tue, 14 Jun 2016 07:20:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCmOX-0007Ot-A4 for qemu-devel@nongnu.org; Tue, 14 Jun 2016 07:20:33 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F370985546 for ; Tue, 14 Jun 2016 11:20:32 +0000 (UTC) Date: Tue, 14 Jun 2016 08:20:31 -0300 From: Eduardo Habkost Message-ID: <20160614112031.GN18662@thinpad.lan.raisama.net> References: <1465855078-19435-1-git-send-email-ehabkost@redhat.com> <1465855078-19435-4-git-send-email-ehabkost@redhat.com> <87d1nkkv07.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d1nkkv07.fsf@dusky.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH v3 3/3] coccinelle: Remove unnecessary variables for function return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org On Tue, Jun 14, 2016 at 10:57:44AM +0200, Markus Armbruster wrote: > Eduardo Habkost 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 > error-next. Oops! > > > 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 > > Signed-off-by: Eduardo Habkost > [...] > > 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. Thanks! -- Eduardo