Re: [PATCH] Remove unused variables.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 25, 2015 at 02:21:52PM -0600, Eric Blake wrote:
On 09/24/2015 01:35 AM, Martin Kletzander wrote:
I was playing with coccinelle tool the other day and just for the fun of
it, I tried removing some useless things from our code.  And look what
came up.  No functional change, and we're down in the number of lines by
about a hundred.

It would be worth including your spatch rule in the commit message, for
a couple of reasons:

If someone tries to backport the patch, having the spatch rule to feed
coccinelle will make it easier to replay the rule from scratch instead
of having to manually resolve any backport conflicts.

Having the ruleset listed lets it be inspected, in case anyone familiar
with coccinelle sees a bug in it, or as a teaching moment for those
trying to learn coccinelle.


Oh, if you want, I can certainly add it, but since there are many
occurrences inside macros that were not made to be handled properly,
etc., I figured it's not worth it.  Anyway, here it is, I'll add it in
the commit message if we decide to put it in.  Anyway, some work on
the macro recognitions would be nice.  I can work on that if you want
to postpone the clean-ups until just applying simple spatch works and
doesn't need further cleaning.

The following spatch is just what we had tested on KVM Forum.

@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;

@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;

@@
type T;
identifier i;
expression E;
@@
- T i = E;
 ... when != i

@@
type T;
identifier i;
@@
- T i;
 ... when != i

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]