Re: [PATCH] sched: add statics, don't return void expressions

From: Peter Zijlstra
Date: Fri Apr 25 2008 - 08:42:56 EST


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/