All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH net-next] net: remove unnecessary return's
Date: Thu, 13 Feb 2014 08:02:39 -0800	[thread overview]
Message-ID: <20140213080239.3e70d546@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1392273125.2214.25.camel@joe-AO722>

On Wed, 12 Feb 2014 22:32:05 -0800
Joe Perches <joe@perches.com> wrote:

> On Wed, 2014-02-12 at 20:51 -0800, Stephen Hemminger wrote:
> > One of my pet coding style peeves is the practice of
> > adding extra return; at the end of function.
> > Kill several instances of this in network code.
> > I suppose some coccinelle wizardy could do this automatically.
> 
> Maybe, but grep version 2.5.4 will show most of them.
> 
> $ grep-2.5.4 -rP --include=*.[ch] "return;\n}" *
> [...]
> 
> Fixing them has to make sure that there's no
> label before the close brace.
> 
> gcc has to have a statement before the close brace
> of a void return after a label.
> 
> label:
> }
> 
> must be:
> 
> label:
> 	;
> }
> 
> to compile.
> 

My method was to use:
 find . -name '*.c' | xargs grep -Pzo '(?s)^(\s*)\Nreturn;.}'
Then ignore cases where it was done for final label and where return
was alone in stub function.

  reply	other threads:[~2014-02-13 16:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13  4:51 [PATCH net-next] net: remove unnecessary return's Stephen Hemminger
2014-02-13  6:32 ` Joe Perches
2014-02-13 16:02   ` Stephen Hemminger [this message]
2014-02-13 21:55   ` Julia Lawall
2014-02-13 22:00     ` Dave Jones
2014-02-13 22:06       ` Julia Lawall
2014-02-13 22:28       ` Julia Lawall
2014-02-13 23:14         ` David Miller
2014-02-14  9:58           ` Julia Lawall
2014-02-14 18:41             ` David Miller
2014-02-14 18:48               ` Dave Jones
2014-02-13 23:33 ` David Miller

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=20140213080239.3e70d546@nehalam.linuxnetplumber.net \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=julia.lawall@lip6.fr \
    --cc=netdev@vger.kernel.org \
    /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.