On Sat, Jul 07, 2007 at 11:32:50PM -0400, Pavel Roskin wrote:

> It looks like the definition of struct st is sort of "weak" when it's
> read from the header included on the command line, so that the forward
> declaration from test.c removes the original definition.
> 
> It's also possible to define struct st to something else, and sparse
> won't warn about it.  But omitting "struct st;" fixes the error, so the
> original definition is known to sparse.

Looks like it gets a scope boundary between those.  There is one case
when presense of struct st; changes things: struct st; in

struct st {....};
....
{
        struct st;
        struct st *p;
        ...
        struct st {....} x;
        ...
}

will make p a pointer to struct st from that scope.  If you omit it,
p will be a pointer to struct st from the outer scope and x will have
a different type.  Too late beginning of file scope, perhaps?
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to