mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: a.p.zijlstra@chello.nl
Cc: viro@ZenIV.linux.org.uk, bharrosh@panasas.com,
	harvey.harrison@gmail.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/10] misc: fix returning void-valued expression warnings
Date: Thu, 01 May 2008 14:27:31 -0700 (PDT)	[thread overview]
Message-ID: <20080501.142731.262496403.davem@davemloft.net> (raw)
In-Reply-To: <1209644226.16449.11.camel@lappy>

From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Thu, 01 May 2008 14:17:06 +0200

> On Thu, 2008-05-01 at 13:00 +0100, Al Viro wrote:
> > On Thu, May 01, 2008 at 02:43:50PM +0300, Boaz Harrosh wrote:
> > 
> > > I don't know who invented sparse, but I like this form of return.
> > > 1 - It saves me the curly brackets and extra return line. But mainly
> > > 2 - It is a programing statement that says: "Me here I'm an equivalent 
> > >   to that other call". So if in the future that inner function starts
> > >   to return, say, an error value, with the first style the compiler will
> > >   error. But with the second style the new error return will be silently
> > >   ignored. So these are not equivalent replacements. The former is a much
> > >   stronger bond between the caller and the callie.
> > 
> > 3.  6.8.6.4(1): A return statement with an expression shall not appear in
> > a function whose return type is void.
> > 
> > Write in C, please.
> 
> We use GNU99 all over the place, or are you going to clear up all the
> statement expressions and such other fancy gnu extensions to the
> language as well?
> 
> I'm really not seeing why this would be wrong, other than the standard
> saying it is, ie. I think the standard got it wrong here.
> 
> Harvey can just use -Wno-return-void, or someone can modify sparse to
> have that default disabled for STANDARD_GNU[89]9.

Even Linus thinks this construct is fine and said he had a patch to
make sparse allow it.  This discussion is pointless especially since
GCC has allowed this since basically day one, and it's even self
consistent.

  parent reply	other threads:[~2008-05-01 21:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-30 22:03 Harvey Harrison
2008-05-01 11:43 ` Boaz Harrosh
2008-05-01 12:00   ` Al Viro
2008-05-01 12:17     ` Peter Zijlstra
2008-05-01 12:51       ` Al Viro
2008-05-01 21:27       ` David Miller [this message]
2008-05-01 12:42     ` Boaz Harrosh
2008-05-01 12:53       ` Al Viro

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=20080501.142731.262496403.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=bharrosh@panasas.com \
    --cc=harvey.harrison@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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®