On 10/5/06, Jörn Engel <joern@xxxxxxxxxxxxxxxxxxxx> wrote:
One advantage over gcc or plain sparse is that code checking can be done in two passes. Pass one collects all sorts of information for every compilation unit. Pass two can then combine the information for all compilation units and do global checking of some sort. For example, the currently debated "may be used uninitialized" warning in gcc is simply not able to detect something like: foo.c: int foo; do_initialize(&foo); do_something(foo); bar.c: void do_initialize(int *bar) { *bar = 0; } The code is 100% correct, but gcc only looks at foo.c and spits out a warning. Smatch can do better than that - if someone writes a checker. Jörn
Actually, I think gcc handles that specific example correctly... If do_initialize() is in the same file it looks to see if it actually initializes it or not. If it's in a seperate file then it assumes that it initializes it and doesn't print a warning. I'm using gcc 4.0.3. regards, dan carpenter - 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