public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: Harvey Harrison <harvey.harrison@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: add statics, don't return void expressions
Date: Fri, 25 Apr 2008 14:42:12 +0200	[thread overview]
Message-ID: <1209127332.32291.1.camel@lappy> (raw)
In-Reply-To: <alpine.LNX.1.10.0804251431510.6645@fbirervta.pbzchgretzou.qr>

On Fri, 2008-04-25 at 14:32 +0200, Jan Engelhardt wrote:
> On Friday 2008-04-25 14:17, Peter Zijlstra wrote:
> >On Thu, 2008-04-24 at 18:17 -0700, Harvey Harrison wrote:
> >> Noticed by sparse:
> >> kernel/sched.c:760:20: warning: symbol 'sched_feat_names' was not declared. Should it be static?
> >> kernel/sched.c:767:5: warning: symbol 'sched_feat_open' was not declared. Should it be static?
> >> kernel/sched_fair.c:845:3: warning: returning void-valued expression
> >> kernel/sched.c:4386:3: warning: returning void-valued expression
> >
> >I'm still of two minds about that latter warning, I think:
> >
> >void foo(void);
> >
> >void bar(void)
> >{
> >	return foo();
> >}
> >
> >isn't wrong, as the return types match.
> 
> But you could save a keyword and use
> 
> void bar(void)
> {
> 	foo();
> }

Sure, but this was just to show the idiom at hand; an actual use case
would be something like this:

void bar(void)
{
	if (cond)
		return foo();

	/* do stuff ourselves */
}

Leaving out the return here does have side-effects.


  reply	other threads:[~2008-04-25 12:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25  1:17 [PATCH] sched: add statics, don't return void expressions Harvey Harrison
2008-04-25 12:17 ` Peter Zijlstra
2008-04-25 12:32   ` Jan Engelhardt
2008-04-25 12:42     ` Peter Zijlstra [this message]
2008-04-25 15:12       ` Jan Engelhardt
2008-04-25 17:56   ` Harvey Harrison

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=1209127332.32291.1.camel@lappy \
    --to=a.p.zijlstra@chello.nl \
    --cc=harvey.harrison@gmail.com \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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