LWN.net Logo

GCC and static analysis

GCC and static analysis

Posted May 2, 2012 15:19 UTC (Wed) by npsimons (guest, #80535)
Parent article: GCC and static analysis

> Static analysis tools will almost certainly be an increasingly important
> part of many developers' tool boxes.

Will be? I don't know about you, but when I'm hacking on C or C++, one of the first things I do is setup my run_tests script to run as many static tools on my code as possible. It's saved me tons of time, and those tools are just ones separate from GCC! I am happy that there is competition, and I still need to look into LLVM/CLANG, but there are other static code checking tools (splint and cppcheck are two that come to mind).


(Log in to post comments)

GCC and static analysis

Posted May 2, 2012 16:21 UTC (Wed) by mathstuf (subscriber, #69389) [Link]

Same here. I don't have static analysis tools enabled in my build trees yet, but all unit tests get coupled with targets to run the following over them:

- valgrind
- callgrind
- helgrind
- cachegrind
- massif
- Also experimental valgrind tools, but I haven't actually used them yet.
- gprof

Fire off the 'valgrind' target, wait a while, come back and inspect memory leaks (mainly in Python from the bindings). Tack that on top of pretty much every warning flag GCC understands, and I am much more sure that the code is safe (though still not correct).

GCC and static analysis

Posted May 4, 2012 16:23 UTC (Fri) by jezuch (subscriber, #52988) [Link]

> Will be? I don't know about you, but when I'm hacking on C or C++, one of the first things I do is setup my run_tests script to run as many static tools on my code as possible.

Same here (in Java, I mean; FindBugs all the way!), but not everyone is so enlightened yet, hence "will be". (I also turn on as many compiler warnings as is practical; and I say "practical" because sometimes there are warnings that are a matter of taste, at least in Java.)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds