[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 3/3] coccinelle: Remove unnecessary variables
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH v3 3/3] coccinelle: Remove unnecessary variables for function return value |
Date: |
Tue, 14 Jun 2016 08:58:07 -0300 |
User-agent: |
Mutt/1.6.1 (2016-04-27) |
On Tue, Jun 14, 2016 at 01:20:14PM +0200, Markus Armbruster wrote:
> Paolo Bonzini <address@hidden> writes:
>
> > On 14/06/2016 10:57, Markus Armbruster wrote:
> >>> 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.
> >>
> >
> > I've seen rule names used as a comment. Feels a bit like COBOL, but it
> > doesn't hurt. Perhaps rename it to "@ return_directly @"?
>
> No objection. However, the existing semantic patches in
> scripts/coccinelle/ don't do that. You guys tell me what to do with
> this one.
I think rule names are just noise if the script has only a single
transformation. In this specific case, the comment and the rule
name were kept by mistake.
--
Eduardo
Re: [Qemu-devel] [PATCH v3 0/3] coccinelle: Clean up error checks and return value variables, Markus Armbruster, 2016/06/14