Академический Документы
Профессиональный Документы
Культура Документы
Cppcheck - ++.
: , ,
, .
: http://cppcheck.sourceforge.net/
Cppcheck , , GNU
General Public License. Daniel Marjamki (
StackOverflow). github.
Cppcheck
Cppcheck 1.60.1 : C89,
C99, C11, C++03, C++11. , ,
:
Code::Blocks - integrated
CodeLite - integrated
Eclipse - Cppcheclipse
gedit - gedit plugin
Hudson - Cppcheck Plugin
Jenkins - Cppcheck Plugin
Tortoise SVN - Adding a pre-commit hook script
Mercurial (Linux) - Adding a pre-commit hook script
Visual Studio / Eclipse - Visual Lint by RiverBlade ( )
Cppcheck
Cppcheck .
. , Cppcheck Windows, GUI ,
.
1. Cppcheck Windows. . .
"Check directory" .
.
2. . .
, , , Cppcheck .
Cppcheck, . ,
, Cppcheck
. , ,
- ! ,
. .
.
: Errors, Warnings, Style Warnings, Portability Warnings, Performance Warnings,
Information Messages. / .
N3 Style Warnings.
"Style Warnings" , (. 1). "cpuid_x86.c"
. , 214
(. 2). (. 3).
3. .
.
Cppcheck .
:
: Checks.
, Cppcheck.
N1. MPlayer.
.
"(!sh->wf || sh->wf->cbSize < 80)", .
....
context_t *ctx = calloc(1, sizeof(context_t));
const SpeexMode *spx_mode;
const SpeexStereoState st_st = SPEEX_STEREO_STATE_INIT;
if (!sh->wf || sh->wf->cbSize < 80) {
mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Missing extradata!\n");
return 0;
}
....
:
libmpcodecs/ad_speex.c:44: Memory leak: ctx
N2. Doom 3.
"sizeof(ctx)" "sizeof(*ctx)". -
'ctx' .
void MD5_Final( MD5_CTX *ctx, unsigned char digest[16] ) {
....
memset( ctx, 0, sizeof( ctx ) );
:
..\Doom3\id-Software-DOOM-3-a9c49da\neo\idlib\hashing\MD5.cpp(252):
Using size of pointer ctx instead of size of its data.
N3. Doom 3.
, , ,
. delete [] sortIndex.
void idImageManager::PrintMemInfo( MemInfo_t *mi ) {
int *sortIndex;
....
..\Quake3\id-Software-Quake-III-Arena-dbe4ddb\lcc\src\2html.c 131
printf format string has 2 parameters but 3 are given
1.
2.
3.
4.
5.
6.
7.
8.
9.
Website: http://cppcheck.sourceforge.net/
Wikipedia: Cppcheck.
Cppcheck forum.
Cppcheck manual: HTML, PDF.
Cppcheck git repository.
, Cppcheck.
Cppcheck. Cppcheck: free, easy, and great.
. Cppcheck PVS-Studio.
Aleksey Vitebskiy. Poor Man's Visual Studio Cppcheck Integration.