搭建PCLint与SourceInsight全套环境

来源:互联网 发布:淘宝动态评分怎么看 编辑:程序博客网 时间:2024/06/05 09:53
1、下载PCLint和SourceInsight工具

      PCLint工具地址:      http://download.csdn.net/detail/u012329294/8280039

     SourceInsight工具地址:  http://download.csdn.net/detail/u012329294/6363931

 2、安装SourceInsight,点击下一步一步步安装即可。

3、安装PCLint时,会要求你配置自己的Lint文件,可以先不用管它(如果以后要配置,点击lint目录下Config.exe就可以进行配置)。

      可以直接手工进行配置,下面介绍手工配置文件方法: 

      1) std.lnt  ---一般作为主入口

          

//  Microsoft Visual C++ 2005, -si4 -sp4, lib-mfc.lnt lib-stl.lnt lib-w32.lnt lib-wnt.lnt
//  Standard lint options

-wlib(0)

co-msc80.lnt
lib-mfc.lnt lib-stl.lnt lib-w32.lnt lib-wnt.lnt
options.lnt  -si4 -sp4
include.lnt

 

      2) include.lnt  ---包含文件头,以下3个文件位置是VS2008时必须的

-I"F:\Program Files\Microsoft Visual Studio 8\VC\include"
-I"F:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include"
-I"F:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include"

 

      3) options.nt  --屏蔽不需要的告警

// 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.

-e720       // allow direct test of assignment
-e537
-e539
-e830
-e438
-e550
-e838
-e529
-e534
-e1773
-e826
-e831
-e774
-e818
-e613  //判断可能为空指针
-e866
-e715
-e725
-e527
-e668
-e734
-e525
-e834
-e732
-e801
-e524
-e790
-e1746
-e653
-e451
-e750
-e713
-e705
-e766

 

4、在SourceInsight上配置对单个文件运行pclint检查

在Custom Commands中Run以下命令:

"C:\lint\lint-nt.exe" -u -ic:\lint std env-si %f

 

5、在SourceInsight上配置对多个文件运行pclint检查

首先在pclint下建立一个新的文件,命令为CZX.lnt,该文件中罗列出所有需要进行pclint检查的部分

具体要获取工程目录下的.cpp文件,可以执行Dos命令: dir /b /s

这样就可以获取目录下的所有文件,把界面复制拷贝到CZX.lnt文件中即可。

在Custom Commands中Run以下命令:

"C:\lint\lint-nt.exe" -u -ic:\lint std env-si CZX

运行就可以一次性将所有文件进行pclint检查。

 

来源 http://blog.csdn.net/u012329294/article/details/42042083

0 0