mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Andrew F. Davis" <afd@ti.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Michal Marek <mmarek@suse.com>, <cocci@systeme.lip6.fr>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] Coccinelle: Add misc/boolconv.cocci
Date: Mon, 17 Oct 2016 16:08:26 -0500	[thread overview]
Message-ID: <01267522-ce8d-9fe8-2ec3-e466f24b8492@ti.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1610172254330.2186@hadrien>

On 10/17/2016 03:54 PM, Julia Lawall wrote:
> On Mon, 17 Oct 2016, Andrew F. Davis wrote:
> 
>> Add a script to check for unneeded conversions to bool.
> 
> What changed since the previous version?
> 

Nothing, just a resend, forgot to label it as such.

Andrew

> julia
> 
> 
>>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
>> ---
>>  scripts/coccinelle/misc/boolconv.cocci | 90 ++++++++++++++++++++++++++++++++++
>>  1 file changed, 90 insertions(+)
>>  create mode 100644 scripts/coccinelle/misc/boolconv.cocci
>>
>> diff --git a/scripts/coccinelle/misc/boolconv.cocci b/scripts/coccinelle/misc/boolconv.cocci
>> new file mode 100644
>> index 0000000..33c464d
>> --- /dev/null
>> +++ b/scripts/coccinelle/misc/boolconv.cocci
>> @@ -0,0 +1,90 @@
>> +/// Remove unneeded conversion to bool
>> +///
>> +//# Relational and logical operators evaluate to bool,
>> +//# explicit conversion is overly verbose and unneeded.
>> +//
>> +// Copyright: (C) 2016 Andrew F. Davis <afd@ti.com> GPLv2.
>> +
>> +virtual patch
>> +virtual context
>> +virtual org
>> +virtual report
>> +
>> +//----------------------------------------------------------
>> +//  For patch mode
>> +//----------------------------------------------------------
>> +
>> +@depends on patch@
>> +expression A, B;
>> +symbol true, false;
>> +@@
>> +
>> +(
>> +  A == B
>> +|
>> +  A != B
>> +|
>> +  A > B
>> +|
>> +  A < B
>> +|
>> +  A >= B
>> +|
>> +  A <= B
>> +|
>> +  A && B
>> +|
>> +  A || B
>> +)
>> +- ? true : false
>> +
>> +//----------------------------------------------------------
>> +//  For context mode
>> +//----------------------------------------------------------
>> +
>> +@r depends on !patch@
>> +expression A, B;
>> +symbol true, false;
>> +position p;
>> +@@
>> +
>> +(
>> +  A == B
>> +|
>> +  A != B
>> +|
>> +  A > B
>> +|
>> +  A < B
>> +|
>> +  A >= B
>> +|
>> +  A <= B
>> +|
>> +  A && B
>> +|
>> +  A || B
>> +)
>> +* ? true : false@p
>> +
>> +//----------------------------------------------------------
>> +//  For org mode
>> +//----------------------------------------------------------
>> +
>> +@script:python depends on r&&org@
>> +p << r.p;
>> +@@
>> +
>> +msg = "WARNING: conversion to bool not needed here"
>> +coccilib.org.print_todo(p[0], msg)
>> +
>> +//----------------------------------------------------------
>> +//  For report mode
>> +//----------------------------------------------------------
>> +
>> +@script:python depends on r&&report@
>> +p << r.p;
>> +@@
>> +
>> +msg = "WARNING: conversion to bool not needed here"
>> +coccilib.report.print_report(p[0], msg)
>> --
>> 2.10.1
>>
>>

  reply	other threads:[~2016-10-17 21:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 16:52 Andrew F. Davis
2016-10-17 20:54 ` Julia Lawall
2016-10-17 21:08   ` Andrew F. Davis [this message]
2016-12-10 22:49 ` 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=01267522-ce8d-9fe8-2ec3-e466f24b8492@ti.com \
    --to=afd@ti.com \
    --cc=Gilles.Muller@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=nicolas.palix@imag.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®