PC-Lint工具使用说明书

1970-01-01 08:00

PC-Lint工具使用说明书

1.使用操作步骤

1、将lint.rar拷贝到C:\\根目录下;解压缩,文件产生在C:\\lint目录下;目录中已经包括配置好的两个工作目录:

C:\\lint\\config_diab //针对Diab编译器 C:\\lint\\config_vc //针对Vc6.0编译器

2、将C:\\lint\\config_diab目录下lin.bat拷贝到代码文件根目录下,如9000改进项目的E:\\PM-8000\\03.Code\\9210下。

建立工程中所有*.cpp文件信息,在Dos命令提示符中代码文件根目录下键入如下命令, E:\\PM-8000\\03.Code\\9210>dir /s /b *.cpp >fs_all.lnt

3、lin.bat的编辑,将lin.bat改成如下: \ +v -i\modules;modules/co;modules/ecga;modules/ibp;modules/keyboard;modules/nibp;modules/recorder;modules/spo2;modules/co2;modules/ag;modules;net;trend;prs \std.lnt -os(_LINT.TMP) %1 %2 %3 %4 %5 %6 %7 %8 %9

@echo off echo ---

echo output placed in _LINT.TMP

\

-i的参数包括两部分:

C:\\lint\\config_diab;指明配置文件std.lnt的路径;其他指明相关头文件的路径; \指的是对输出结果的执行文件。

4、在命令行下输入如下命令:

E:\\PM-8000\\03.Code\\9210>lin –e46 –w2 fs_all.lnt //产生所有检查结果 -e46,表示检查结果不显示-e46的信息

–w2,表示检查结果只显示warning level 2以上的信息

也可只对一个文件,或部分文件进行检查:

E:\\PM-8000\\03.Code\\9210>lin modules\\dataproc.cpp //对dataproc.cpp检测

5、在source insight工作窗口中增加按钮和快捷键,链接PC-Lint工具:

a.建立检查当前文件的按钮和快捷键

选择source insight-〉options-〉custom commands

图a.1

弹出custom commands窗口:

图a.2

点击add…,输入PC-lint,选择OK:

图a.3

配置custom commands窗口如下,

图a.4

选择run就可检查当前文件代码文件了。

在options Menu中增加PC-lint项链接PC-Lint工具:在custom commands窗口中点击Menu;在Menu Assignments中选择Options项,Menu Contents选择Custom Commands项,点击Insert按钮:

图a.5

增加快捷键ctr+1链接PC-Lint工具:在custom commands窗口中点击Keys;在Key Assignments中点击Assign New Key项,输入ctr+1,点击Ok

图a.6

b.建立检查当前工程所有代码文件的按钮(PC-Lint 2)和快捷键ctr+2;方法与a一致;只需名字改动一下。

并且在图a.4改成输入E:\\PM-8000\\03.Code\\9210\\lin.bat fs_all.lnt;检查所有文件。

2.结果说明

检查代码文件输出的结果保存在_LINT.TMP文件中,结构如下: --- Module: E:\\PM-8000\\03.Code\\9210\\modules\\recorder\\rec_tg.cpp _ VOID Application_Initialize(VOID *);

system\\main.h 83 Error 1065: Symbol 'Application_Initialize(void *)' not declared as \ _ extern SYSINFO gSysInfo;

E:\\PM-8000\\03.Code\\9210\\modules\\recorder\\rec_tg.cpp 19 Info 762: Redundantly declared symbol 'gSysInfo' previously declared at line 85, file modules\\recorder\\recorder.h

modules\\recorder\\recorder.h 85 Info 830: Location cited in prior message ……

--- Global Wrap-up

Warning 526: 'gMultiLangInfo' (line 55, E:\\PM-8000\\03.Code\\9210\\modules\\recorder\\rec_tg.cpp) not defined

file

E:\\PM-8000\\03.Code\\9210\\modules\\recorder\\rec_tg.cpp 55 Info 830: Location cited in prior message

Number of bytes read = 125007

Message num ID =522, Counts=2 Message num ID =524, Counts=2 Message num ID =525, Counts=13 Message num ID =526, Counts=1 Message num ID =529, Counts=3 Message num ID =534, Counts=193 Message num ID =539, Counts=7 Message num ID =550, Counts=1 Message num ID =578, Counts=2 Message num ID =641, Counts=37 Message num ID =668, Counts=2 Message num ID =702, Counts=1 Message num ID =708, Counts=1 Message num ID =713, Counts=1 Message num ID =725, Counts=4 Message num ID =732, Counts=27 Message num ID =734, Counts=40 Message num ID =736, Counts=12 Message num ID =752, Counts=1 Message num ID =762, Counts=31 Message num ID =771, Counts=2 Message num ID =825, Counts=1 Message num ID =830, Counts=258 Message num ID =831, Counts=2 Message num ID =834, Counts=14 Message num ID =1065, Counts=1

3.可选配置

通过在lint命令中增加选项可对输出信息进行控制: 1、-e#,控制不输出某个信息 -e46 //Field type should be int

-e537 // Repeated include file 2、-w#,控制输出信息级别 -w2 //只输出2级以上的信息,即warning,error信息

3、根据统计信息,将某种无影响的信息屏蔽,减少信息输出量,以上面的输出结果为例

Message num ID =534, Counts=37 // Warning 534: Ignoring return value of

function 'strcpy(char *, const char *)' (compare with line 23, file c:\\diab\\4.3g\\include\\string.h)

配置项可以集中在options.lnt中配置:打开C:\\lint\\config_diab\\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. -w2 -e18 //Symbol 'Symbol' redeclared (TypeDiff) conflicts with Location -e46 //Field type should be int -e537 //Repeated include file

//-e720 // allow direct test of assignment

//-e502 -e713 -e737 -eau // don't report on signed/unsigned mismatches //-e718 // allow calls to undeclared C functions //-e746 // allow calls w/o prototypes in C.


PC-Lint工具使用说明书.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2018届江苏省南京师范大学附属中学高三语文模拟考试试题

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: