kunzj的个人空间 https://blog.eetop.cn/200421 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

PCLINT

已有 2860 次阅读| 2011-8-30 23:27

最近项目正在使用PC-Lint做代码的静态检查,从一开始对它的不了解抵触它,到现在我希望用一系列的文章来介绍它,的确个人认为它是一个不错的静态代码检测工具。它不但能够监测出许多语法逻辑上的隐患,而且也能够有效地帮你提出许多程序在空间利用、运行效率上的改进点。不仅对于个人或者公司,PC-Lint做代码静态检查都是具有明显的好处:

1. 对于公司可以控制代码的质量,使代码符合公司的代码规范,从而尽可能减少bug的产生。

2. 可以通过PC-Lint的检查代码,从而发现代码运行效率上的改进点,改进代码运行效率。

3. 对于个人也是一个学习的过程,个人可以从PC-Lint报出的error里学习到自己写的代码到底还有哪些不足的地方,并且可以思考这些不足的地方为什么PC-Lint认为是一个可以改进点,从而使自己的程序日臻完美,完全用实践来证明理论,而不是天天拿着Effective C++/More Effective C++诵读。

这么多的优点,没有理由不让你了解PC-Lint,所以我准备下一步用另外两篇文章来介绍PC-Lint:

1.      PC-Lint的安装、设置以及公司内部PC-Lint Criteria的设立,这部分需要结合Clear-Case来说明对于一个企业是如何全局控制PC-Lint的安装与rule版本的。

2.      PC-Lint的使用,在这里会根据个人在项目中的经验对一些常见的rule进行解释,并根据自己的切身体会介绍如何用好PC-Lint.
PC Lint Integration in VS, ClearCase
In this article, I want to talk about how to integrate PCLint, ClearCase and VS.net together. First, in order to let every team member use PCLint in the same way, we should put PCLint program, company common rules and company’s wrapper file into Clearcase. The directory structure in ClearCase is as below:

Wrapper

Private command wrapper sets

Rules

Private rule sets

Gimpel

Original Gimpel Software


In “Wrapper” directory, there are two main files called “PCLint_VC_Project.cmd” and “Proj2lnt.pl”, I want to use a diagram to explain the relationship and functions between them.



The “
PCLint_VC_Project.cmd” file is an entry for lint the source file/project in VS. We can add a plug in VS SDE. You can referenced the related article at:  http://blog.vckbase.com/eyesonyhm/archive/2010/05/14/42330.html

 

Syntax:  

PCLint_VC_Project.cmd Project Configuration RuleSet [File]

 

Example:      

PCLint_VC_Project.cmd example.vcproj Debug [abc.cpp]

 

Without specifying a [File] the whole project is linted.

The lint wrapper works in three steps.

  1. The vcproj file is translated into the lint format by Proj2lnt.pl script.
  2. The translated lint rule and a rule set file is used for linting the project / file by lint-nt.exe
  3. Output the message from PCLint

 

The file “Proj2lnt.pl” is used to translate the vcproj file in to lint format. Because in every lint process, it needs the configuration from project file, like include path, macro definition etc.
The related file is in:
http://blog.vckbase.com/Files/eyesonyhm/proj2lnt.zip



点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 0

    获赞
  • 1

    评论
  • 309

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-23 17:10 , Processed in 0.029821 second(s), 13 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部