Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1206210

Re: [RFC] coccinelle: add style check for assignment in if

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject Re: [RFC] coccinelle: add style check for assignment in if
Date 2015-08-12 17:20 +0200
Message-ID <pWFYS-8aR-23@gated-at.bofh.it> (permalink)
References <pWEJs-6cZ-5@gated-at.bofh.it> <pWF2O-6ON-23@gated-at.bofh.it> <pWFPc-7Zw-3@gated-at.bofh.it> <pWFPc-7Zw-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, 12 Aug 2015, Michal Marek wrote:

> On 2015-08-12 16:53, Kris Borer wrote:
> > On Wed, Aug 12, 2015 at 10:12 AM, Michal Marek <mmarek@suse.cz
> > <mailto:mmarek@suse.cz>> wrote:
> >
> >     On 2015-08-12 15:51, Kris Borer wrote:
> >     > Add a semantic patch for fixing some cases of checkpatch.pl <http://checkpatch.pl> error:
> >     >
> >     > ERROR: do not use assignment in if condition
> >
> >     There is a gcc warning for this already.
> >
> >     Michal
> >
> >
> > ​My intention was not to create another way to uncover problems but
> > rather to ​provide a tool for people to use to fix them. Let me know if
> > I am misunderstanding the purpose of this subsystem.
>
> OK, so this is fixing a style issue, and not cases of accidental
> assignment instead of '==' (for which there is a gcc warning and we
> hopefully do not have such errors in the kernel). While I'm probably
> ignorant and no not see how one style is better than the other, I see
> that some maintainers already applied your patches based on this check.
> So I'll merge it once Julia acks it.

Actually, assignments inside if tests are really annoying for Coccinelle,
because there become two different control flows from the assignment to
the test on the result.  So I would be happy to see these go away.

I'll check the semantic patch as soon as possible.

julia

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC] coccinelle: add style check for assignment in if Kris Borer <kborer@gmail.com> - 2015-08-12 16:00 +0200
  Re: [RFC] coccinelle: add style check for assignment in if Julia Lawall <julia.lawall@lip6.fr> - 2015-08-12 16:10 +0200
  Re: [RFC] coccinelle: add style check for assignment in if Michal Marek <mmarek@suse.cz> - 2015-08-12 16:20 +0200
    Re: [RFC] coccinelle: add style check for assignment in if Michal Marek <mmarek@suse.cz> - 2015-08-12 17:10 +0200
      Re: [RFC] coccinelle: add style check for assignment in if Julia Lawall <julia.lawall@lip6.fr> - 2015-08-12 17:20 +0200

csiph-web