[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181203085230.GB2516@gmail.com>
Date: Mon, 3 Dec 2018 09:52:30 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "Paul E. McKenney" <paulmck@...ux.ibm.com>,
Wen Yang <wen.yang99@....com.cn>,
Davidlohr Bueso <dave@...olabs.net>,
Josh Triplett <josh@...htriplett.org>,
linux-kernel@...r.kernel.org, zhong.weidong@....com.cn,
mingo@...hat.com, will.deacon@....com
Subject: Re: [PATCH] locktorture: Fix assignment of boolean variables
* Peter Zijlstra <peterz@...radead.org> wrote:
> On Sat, Dec 01, 2018 at 12:37:01PM -0800, Paul E. McKenney wrote:
> > On Sat, Dec 01, 2018 at 04:31:49PM +0800, Wen Yang wrote:
> > > Fix the following warnings reported by coccinelle:
> > >
> > > kernel/locking/locktorture.c:703:6-10: WARNING: Assignment of bool to 0/1
> > > kernel/locking/locktorture.c:918:2-20: WARNING: Assignment of bool to 0/1
> > > kernel/locking/locktorture.c:949:3-20: WARNING: Assignment of bool to 0/1
> > > kernel/locking/locktorture.c:682:2-19: WARNING: Assignment of bool to 0/1
> > > kernel/locking/locktorture.c:688:2-19: WARNING: Assignment of bool to 0/1
> > > kernel/locking/locktorture.c:648:2-20: WARNING: Assignment of bool to 0/1
> > > kernel/locking/locktorture.c:654:2-20: WARNING: Assignment of bool to 0/1
> > >
> > > This patch also makes the code more readable.
> > >
> > > Signed-off-by: Wen Yang <wen.yang99@....com.cn>
> > > CC: Davidlohr Bueso <dave@...olabs.net>
> > > CC: "Paul E. McKenney" <paulmck@...ux.ibm.com>
> > > CC: Josh Triplett <josh@...htriplett.org>
> > > CC: linux-kernel@...r.kernel.org
> >
> > Adding the current maintainers on CC.
>
> So I strongly disagree with this. Anybody that has trouble with 0/1 vs
> false/true needs to stay the heck away from C.
Indeed, and it's actually *worse* to read, as 0/1 stands out more and is
more compact than false/true...
The only reasonable case where bool is recommended is when functions are
returning it, to make sure there's no mishap returning something else.
But for a plain .c variable? Nope.
> I would suggest we delete that stupid coccinelle scripts that generates
> these pointless warns.
Ack.
Thanks,
Ingo
Powered by blists - more mailing lists