All of lore.kernel.org
 help / color / mirror / Atom feed
From: josh@joshtriplett.org (Josh Triplett)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH] coccinelle: Add a script to find and remove unnecessary ifs with no body
Date: Sat, 2 Nov 2013 08:05:20 -0700	[thread overview]
Message-ID: <20131102150520.GV15704@leaf> (raw)
In-Reply-To: <alpine.DEB.2.02.1311021550330.2261@hadrien>

On Sat, Nov 02, 2013 at 03:51:50PM +0100, Julia Lawall wrote:
> On Sat, 2 Nov 2013, Josh Triplett wrote:
> 
> > This script matches code like:
> >
> > if (foo) {}
> >
> > and either eliminates it (if foo has no side effects) or replaces it
> > with foo (if foo has side effects).
> >
> > Works perfectly in report mode; the results of patch mode are
> > semantically correct but may still benefit from further simplification.
> 
> Actually, I would get rid of the patch mode.  Looking through some of the
> results, I don't see any where just deleting the code is the right thing
> to do.  They all look like cases where the developer wanted to remember to
> think more about the problem.

I observed several where the patch seemed entirely correct, with no
FIXME/TODO/XXX comments associated with the conditional.

Nonetheless, I don't mind removing the patch mode if you don't think
it's worthwhile.  I'll send a v2.

- Josh Triplett

WARNING: multiple messages have this Message-ID (diff)
From: Josh Triplett <josh@joshtriplett.org>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Michal Marek <mmarek@suse.cz>,
	linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr
Subject: Re: [PATCH] coccinelle: Add a script to find and remove unnecessary ifs with no body
Date: Sat, 2 Nov 2013 08:05:20 -0700	[thread overview]
Message-ID: <20131102150520.GV15704@leaf> (raw)
In-Reply-To: <alpine.DEB.2.02.1311021550330.2261@hadrien>

On Sat, Nov 02, 2013 at 03:51:50PM +0100, Julia Lawall wrote:
> On Sat, 2 Nov 2013, Josh Triplett wrote:
> 
> > This script matches code like:
> >
> > if (foo) {}
> >
> > and either eliminates it (if foo has no side effects) or replaces it
> > with foo (if foo has side effects).
> >
> > Works perfectly in report mode; the results of patch mode are
> > semantically correct but may still benefit from further simplification.
> 
> Actually, I would get rid of the patch mode.  Looking through some of the
> results, I don't see any where just deleting the code is the right thing
> to do.  They all look like cases where the developer wanted to remember to
> think more about the problem.

I observed several where the patch seemed entirely correct, with no
FIXME/TODO/XXX comments associated with the conditional.

Nonetheless, I don't mind removing the patch mode if you don't think
it's worthwhile.  I'll send a v2.

- Josh Triplett

  reply	other threads:[~2013-11-02 15:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-02 14:32 [Cocci] [PATCH] coccinelle: Add a script to find and remove unnecessary ifs with no body Josh Triplett
2013-11-02 14:32 ` Josh Triplett
2013-11-02 14:51 ` [Cocci] " Julia Lawall
2013-11-02 14:51   ` Julia Lawall
2013-11-02 15:05   ` Josh Triplett [this message]
2013-11-02 15:05     ` Josh Triplett
2013-11-02 15:09     ` [Cocci] " Julia Lawall
2013-11-02 15:09       ` Julia Lawall
2013-11-02 15:15   ` [Cocci] [PATCHv2] coccinelle: Add a script to find " Josh Triplett
2013-11-02 15:15     ` Josh Triplett
2013-11-02 16:49     ` [Cocci] " Julia Lawall
2013-11-02 16:49       ` Julia Lawall
2013-11-08 13:52       ` [Cocci] " Michal Marek
2013-11-08 13:52         ` Michal Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131102150520.GV15704@leaf \
    --to=josh@joshtriplett.org \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.