On Sun, Jun 1, 2008 at 8:42 PM, Vegard Nossum <vegard.nossum@xxxxxxxxx> wrote: > I was playing with sparse to see what it would accept, and I was > actually surprised at how many "obviously wrong" constructs it > accepted. Because sparse is supposed to warn about this, isn't it? Or > is there a policy not to warn about things that gcc already rejects? > If that were the case, I believe it would reduce the overall > usefulness of sparse. > > (I say "obviously wrong" because I don't see how they can be valid, > but I might of course be mistaken :-)) > > Anyway, here are my test cases: > Here are some more that all produce errors or at least warnings with gcc but pass silently with sparse: ==> extern-struct.c <== /* Empty declaration */ extern struct t { }; ==> inline-struct.c <== /* "inline" has no meaning here. */ inline struct t { }; ==> struct-struct.c <== /* What does this mean? */ struct struct { }; ==> struct-typedef.c <== /* Anonymous typedef or struct named "typedef"? */ struct typedef { }; ==> typedef-cast.c <== /* Cast to typedef doesn't make sense. */ static int x = (typedef int) 0; ==> typedef-struct.c <== /* Anonymous typedef? */ typedef struct { }; Vegard -- "The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation." -- E. W. Dijkstra, EWD1036 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html