Re: [PATCH] drivers/base - fix sparse warnings

From: Ben Dooks
Date: Thu Oct 13 2005 - 13:25:26 EST


On Thu, Oct 13, 2005 at 11:10:15AM -0700, Linus Torvalds wrote:
>
>
> On Thu, 13 Oct 2005, Ben Dooks wrote:
> >
> > The patch does not solve all the sparse errors generated,
> > but reduces the count significantly.
>
> Well, you should also then remove the _bad_ declarations.

Sorry, I do not follow you, can you clarify this for me.
My patch did not generate any more errors, just removed the ones
that where easy to see a solution too.

> For example, attribute_container_init() right now is defined in
> attribute_container.c, but then it's _declared_ (with no checking) where
> it's used in init.c.
>
> The sparse warnign is appropriate: it was not declared where that
> declaration is actually visible to the definition, so the code basically
> isn't type-safe at all (since there's nothing that enforces the
> declaration actually matching the definition).
>
> You made the declaration properly visible, but you should also remove the
> bogus declaration. A declaration that isn't visible to the definition is
> always bad - since in the absense of a compiler with global visibility it
> may or may not actually match what it supposedly declares.
>
> I wonder if I should make sparse warn about multiple declarations..

I pulled the old declerations out of drivers/base/init.c ? I'm sure
the patch shows that?

--
Ben (ben@xxxxxxxxx, http://www.fluff.org/)

'a smiley only costs 4 bytes'
-
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/