[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need help with improving package descriptions for Cppcheck



Hi,

Thanks to both of you for your previous answers. I tried to combine the best parts from both of the mails and even tried to add some more information about Cppcheck into the description. I'm starting to worry whether it is starting to be too long, or if I'm writing something too biased there.


Few notices:
> C-style pointer cast in cpp file

Means e.g.
int a = (int)b;
instead of C++ style
int a = static_cast<int>(b);

> redundant if

Means e.g.
if( a ) { delete a; }

Because deleting 0 is safe. That can be written as:
delete a;

But these are style checks, enabled only when --enable=style is given. I removed the optimization checks from the list. Not sure should I remove the style checks also and focus on the actual errors only?



There is now also a ticket about using memset into simple classes in upstream, so errors related to those should be soon removed:
http://sourceforge.net/apps/trac/cppcheck/ticket/1347


Here is what I got now. Please let me know if you think something should be removed or added. Don't be shy, I will be happy to remove half of it or rewrite it if you think so.:
--------------
tool for static C/C++ code analysis

Cppcheck is a command-line tool that tries to detect bugs that your C/C++ compiler doesn't see. Cppcheck is versatile, and can check non-standard code that includes various compiler extensions, inline assembly code, etc. Cppcheck has internal preprocessor which can handle includes, macros and several preprocessor commands. For some checks, Cppcheck does quite complex analysis for the variables and it can e.g. track the lifetime of a variable into called function to locate memory leaks and buffer overruns, but it doesn't detect such issues with full accuracy. Cppcheck is configurable, but normal checking requires only a path to the source file or a folder, so it is easy to take it into use.

It includes checks for:
* pointers to out-of-scope auto variables;
* assignment of auto variables to an effective parameter of a function;
* out-of-bounds arrays;
* missing class constructors;
* variables not initialized by a constructor;
* use of memset, memcpy, etcetera on a class;
* non-virtual destructors for base classes;
* failure of the = operator to return a constant reference to itself;
* unused private functions;
* use of deprecated functions (mktemp, gets, scanf);
* exceptions thrown in destructors;
* memory leaks in class or function variables;
* C-style pointer cast in cpp file
* redundant if
* misuse of the strtol or sprintf functions;
* unsigned division or division by zero;
* unused struct members;
* passing parameters by value;
* misuse of signed char variables;
* condition that is always true/false
* unusual pointer arithmetic (such as "abc" + 'd');
* dereferenced null pointers;
* incomplete statements;
* out of bounds errors in STL;
* misuse of iterators when iterating through a container;
* dereferencing of erased iterators;
* use of invalidated vector iterators/pointers;
* functions that are never called.


--
Reijo


Reply to: