: : 05.12.2006
++ .
PC-Lint
8.0.
++ . , . , . , TestComplete (http://www.automatedqa.com)
, .
, , . , , Coverity Incorporated (http://www.coverity.com) Gimpel Software PC-Lint (http://www.gimpel.com), . Viva64 (http://www.viva64.com), 64.
1.
PC-Lint
PC-lint . , . PC-lint , . ,
1.
2.
3.
4.
5. PC-lint,
. , . , . C.
, ,
6.
7. .
8. .
9. PC-lint PC-lint Visual Studio 2005 Visual Studio 2005. Visual Studio 2003, . ,
2.
10. . , .
, , . . . PC -lint, ,
. Visual C++
12.
13.
, .
LNT ,
"C:\Lint\lnt" .
14. , , (
, ) .
15. ( . , Mesa),
16. , "unknown.h".
. PC-lint #include
17.
18. .
, , "No".
PC -
, :
if ( (a = b) ) { ... }
. . vc7.lnt" , . .
21.
20
22. .
PC-lint
8.00,
"C:\Lint" (
. . , "options.lnt". // Please note -- this is a representative set of error suppression // options. Please adjust to suit your own policies // See manual (chapter LIVING WITH LINT) // for further details. -e820 // allow test of parenthesized assignment ( 15). , : . PC-lint. : "options.lnt" "std.lnt".
if ( (a = b) ) { ... }
"options.lnt",
. "options.lnt" PC-lint , "std.lnt". , "std.lnt": // Microsoft Visual C++ .NET 2003, // -si4 -sl4 -sp8, lib-mfc.lnt lib-stl.lnt lib-w32.lnt // Standard lint options co-msc71.lnt "#include" / ++.
lib-mfc.lnt lib-stl.lnt lib-w32.lnt options.lnt -si4 -sl4 -sp8 -iD:\ASRC\fox-lib\fox-1.4.4\include -iD:\ASRC\Libraries\mesa\include "co-msc71.lnt" ( #include Visual C++ 2003. / ++) "co-msc80.lnt". . "env-vc8.lnt", PC-Lint , , Visual Studio. ( "std.lnt"), "options.lnt -si4 -sl4 -sp8" . . , PC-lint. . / , , , "std.lnt". , . "options.lnt", . , , , "env-vc7.lnt" "env-vc7.lnt" . "env-vc8.lnt", Visual Studio, , "std.lnt" "options.lnt". MSVC. "std.lnt" PC-lint.
, "std.lnt" -iD:\ASRC\fox-lib\fox-1.4.4\include -iD:\ASRC\Libraries\mesa\include co-msc80.lnt env-vc7.lnt lib-mfc.lnt lib-stl.lnt lib-w32.lnt -si4 -sl4 -sp8 -w3 -e820 :
-w##.
PC -lint
MSVC.
. .
25.
Tools.
PC-lint
24.
3.
PC-lint.
PC-lint ( .
MSVC. );
26.
"Add".
27.
28. "Tools".
OK.
29. Check". ). ,
"Project Creation" (
"Project
30. .
"Unit Check".
31. .
"Tools" . PC-lint
(Project Creation),
32. .
33.
Win32
34. . ,
, , (/W4).
"Finish".
#include "stdafx.h" TCHAR FooTxt[] = _T("foo"); bool Foo(int argc, _TCHAR* argv[]) { for (int i = 0; i != argc; ++i) { if (_tcscmp(argv[i], FooTxt) == 0) { return true; } } return false; } int _tmain(int argc, _TCHAR* argv[]) { if (Foo(argc, argv)) return 1;
return 0; }
PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006 --- Module: .\SimpleProjectForPClint.cpp (C++) } .\SimpleProjectForPClint.cpp(14): error 818: (Info -- Pointer parameter 'argv' (line 5) could be declared as pointing to const) .\SimpleProjectForPClint.cpp(5): error 830: (Info -- Location cited in prior message) --- Module: .\stdafx.cpp (C++) --- Wrap-up for Module: .\stdafx.cpp .\stdafx.cpp(9): error 766: (Info -- Header file 'D:\WORK3\SimpleProjectForPClint\SimpleProjectForPClint\stdafx.h' not used in module '.\stdafx.cpp') --- Global Wrap-up .\SimpleProjectForPClint.cpp(5): error 765: (Info -- external 'Foo(int, unsigned short **)' (line 5, file .\SimpleProjectForPClint.cpp) could be made static) .\SimpleProjectForPClint.cpp(3): error 765: (Info -- external 'FooTxt' (line 3, file .\SimpleProjectForPClint.cpp) could be made static) D:\WORK3\SimpleProjectForPClint\SimpleProjectForPClint\stdafx.h(9): error 755: (Info -- global macro 'WIN32_LEAN_AND_MEAN' (line 9, file D:\WORK3\SimpleProjectForPClint\SimpleProjectForPClint\stdafx.h) not referenced) error 900: (Note -- Successful completion, 6 messages produced) . , : PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006 --- Module: .\pclint.cpp (C++) _ #include <stdio.h> D:\Sources\pclint\stdafx.h(10) : Error 322: Unable to open include file , .
'stdio.h' , INCLUDE, echo %INCLUDE% : C:\Program Files\Microsoft Visual Studio 8\VC\ TLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include;7 Visual Studio , , PC -lint. ,
35. PC-lint.
F4
Output,
PC-lint 8.00
2. 3. 4. 5. 6.
Wikipedia, "Dynamic testing", http://www.viva64.com/go.php?url=45 Wikipedia, "Static testing", http://www.viva64.com/go.php?url=46 Wikipedia, "Static code analysis", http://www.viva64.com/go.php?url=31 Wikipedia, "White box testing", http://www.viva64.com/go.php?url=47 Wikipedia, "Black box testing", http://www.viva64.com/go.php?url=48