Re: [PATCH] sched: Remove nested extern
From: Peter Zijlstra
Date: Mon Sep 22 2014 - 16:05:43 EST
On Mon, Sep 22, 2014 at 07:32:04PM +0000, Rustad, Mark D wrote:
> On Sep 22, 2014, at 12:01 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > On Mon, Sep 22, 2014 at 10:55:11AM -0700, Mark D Rustad wrote:
> >> Avoid W=2 nested-externs warning by moving the nested extern to
> >> a normal extern. This eliminates that warning which is generated
> >> for every inclusion of sched.h in a kernel build when W=2 is used.
> >> This also removes a point of maintenance if the definition of
> >> delayacct_on were ever to change.
> >
> > Yeah, so why is that warning worth using? Just disable the warn if
> > you're bothered by it.
>
> I assume that nested-externs is included in W=2 because many uses of
> them, especially with function prototypes, creates a risk of inconsistent
> declarations. The kernel has a fair number of them that seem to have
> been added to disentangle include files. If they are judged to be
> worthwhile, then it would be good to silence the warnings so that
> attention can be given to other instances of the warnings. If those
> nested externs are not worth the risk, well that is a different conversation.
So would using something like LTO not be way better at actually finding
the problems, seeing how it can actually see the inconsistency in
declarations.
It seems to me that banning the use of nested extern is misguided as
they are a useful tool; they provide some means of keeping symbols from
being globally visible even though they actually are. Its a really poor
man's 'private', but its the best C provides.
Also, why do you care about W=2 nonsense anyhow? They're default
disabled for a reason.
--
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/