Cppcheck is an analysis tool for C/C++ code. Unlike C/C++ compilers and many other analysis tools, Cppcheck don't detect syntax errors. Cppcheck only detects the types of bugs that the compilers normally fail to detect. The goal is no false positives.
The time Cppcheck takes depends on how complex the code is. The more execution paths, variables, etc there are, the more analysis is made.In general the complexity grows much faster than the number of lines of code. Files with normal size are mostly much faster to analyse than big files.
Installation:
OpenSuSe user can install Cppcheck using "1-click" installer - here
Cppcheck usage:
Recursively check the current folder. Print the progress on the screen and write errors in a file:
cppcheck . 2> err.txt
Recursively check ../myproject/ and print only most fatal errors:
cppcheck --quiet ../myproject/
Check only files one.cpp and two.cpp and give all information there is:
cppcheck -v -a -s one.cpp two.cpp
Check f.cpp and search include files from inc1/ and inc2/:
cppcheck -I inc1/ -I inc2/ f.cpp
Below is the example of tunning ccpcheck on Linux kernel source code 2.6.31.5
Output contains lots of warnings ....
Tuesday, June 15, 2010
0 comments:
Post a Comment