From: joe@perches.com (Joe Perches)
To: cocci@systeme.lip6.fr
Subject: [Cocci] coccinelle & linux-kernel: unindent blocks by reversing tests?
Date: Sun, 18 Mar 2018 11:25:53 -0700 [thread overview]
Message-ID: <1521397553.27411.38.camel@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1803181848370.2420@hadrien>
On Sun, 2018-03-18 at 18:50 +0100, Julia Lawall wrote:
>
> On Sun, 18 Mar 2018, Joe Perches wrote:
>
> > There are many blocks of code that could be
> > unindented and so neatened by reversing tests.
[]
> > Which often saves many vertical lines by reducing
> > now unnecessary line-wrapping done at 80-columns.
>
> I tried it. One can't easily make the transformation when there is a
> variable declaration in the block. And Coccinelle doesn't move leading
> comments over to the left. Most of the examples I found seemed to have
> only one level of opportunity. I don't know if the churn is worth it in
> that case. On a more complex example, the pretty printer crashes, so I'll
> have to look into that.
[]
> > A trivial hand-produced example selected randomly:
[]
> > ---
> > .../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 455 +++++++++------------
> > 1 file changed, 201 insertions(+), 254 deletions(-)
Dunno about the churn, but converting many lines of badly
wrapped simple statements and reducing line count seems
somewhat worthwhile.
WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: cocci@systeme.lip6.fr
Subject: Re: coccinelle & linux-kernel: unindent blocks by reversing tests?
Date: Sun, 18 Mar 2018 18:25:53 +0000 [thread overview]
Message-ID: <1521397553.27411.38.camel@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1803181848370.2420@hadrien>
On Sun, 2018-03-18 at 18:50 +0100, Julia Lawall wrote:
>
> On Sun, 18 Mar 2018, Joe Perches wrote:
>
> > There are many blocks of code that could be
> > unindented and so neatened by reversing tests.
[]
> > Which often saves many vertical lines by reducing
> > now unnecessary line-wrapping done at 80-columns.
>
> I tried it. One can't easily make the transformation when there is a
> variable declaration in the block. And Coccinelle doesn't move leading
> comments over to the left. Most of the examples I found seemed to have
> only one level of opportunity. I don't know if the churn is worth it in
> that case. On a more complex example, the pretty printer crashes, so I'll
> have to look into that.
[]
> > A trivial hand-produced example selected randomly:
[]
> > ---
> > .../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 455 +++++++++------------
> > 1 file changed, 201 insertions(+), 254 deletions(-)
Dunno about the churn, but converting many lines of badly
wrapped simple statements and reducing line count seems
somewhat worthwhile.
WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors <kernel-janitors@vger.kernel.org>,
cocci <cocci@systeme.lip6.fr>
Subject: Re: coccinelle & linux-kernel: unindent blocks by reversing tests?
Date: Sun, 18 Mar 2018 11:25:53 -0700 [thread overview]
Message-ID: <1521397553.27411.38.camel@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1803181848370.2420@hadrien>
On Sun, 2018-03-18 at 18:50 +0100, Julia Lawall wrote:
>
> On Sun, 18 Mar 2018, Joe Perches wrote:
>
> > There are many blocks of code that could be
> > unindented and so neatened by reversing tests.
[]
> > Which often saves many vertical lines by reducing
> > now unnecessary line-wrapping done at 80-columns.
>
> I tried it. One can't easily make the transformation when there is a
> variable declaration in the block. And Coccinelle doesn't move leading
> comments over to the left. Most of the examples I found seemed to have
> only one level of opportunity. I don't know if the churn is worth it in
> that case. On a more complex example, the pretty printer crashes, so I'll
> have to look into that.
[]
> > A trivial hand-produced example selected randomly:
[]
> > ---
> > .../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 455 +++++++++------------
> > 1 file changed, 201 insertions(+), 254 deletions(-)
Dunno about the churn, but converting many lines of badly
wrapped simple statements and reducing line count seems
somewhat worthwhile.
next prev parent reply other threads:[~2018-03-18 18:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-18 16:51 [Cocci] coccinelle & linux-kernel: unindent blocks by reversing tests? Joe Perches
2018-03-18 16:51 ` Joe Perches
2018-03-18 16:51 ` Joe Perches
[not found] ` <alpine.DEB.2.20.1803181848370.2420@hadrien>
2018-03-18 18:25 ` Joe Perches [this message]
2018-03-18 18:25 ` Joe Perches
2018-03-18 18:25 ` Joe Perches
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=1521397553.27411.38.camel@perches.com \
--to=joe@perches.com \
--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.