Ubuntu中C代码静态检查工具Splint的安装配置和使用

1、  http://www.splint.org/download.html下载splint-3.1.2.src.tgz,存放到/home/spring/Splint文件夹下;

2、  打开终端;

3、  解压缩:tar zxvfsplint-3.1.2.src.tgz

4、  安装到/usr/local/splint目录下:

        sudo mkdir /usr/local/splint

       cd splint-3.1.2

       ./configure --prefix=/usr/local/splint

       sudo apt-getinstall flex

       make

       sudo make install

5、  配置,打开当前的bash资源文件

      vi ~/.bashrc

      在文件最后加入:

      exportLARCH_PATH=/usr/local/splint/share/splint/lib

      exportLCLIMPORTDIR=/usr/local/splint/share/splint/imports

      exportPATH=/usr/local/splint/bin:$PATH

      退出文件

      source~/.bashrc 

 

测试:test.c

void fun()

{

    int*p = NULL;

}

在终端输入 splint test.c

Splint 3.1.2 --- 25 Jan 2013

 

test.c: (in function fun)

test.c:3:7: Variable p declared but notused

  Avariable is declared but never used. Use /*@unused@*/ in front of

 declaration to suppress message. (Use -varuse to inhibit warning)

 

Finished checking --- 1 code warning

 

 

参考文献:

1、  http://www.splint.org/

2、  http://blog.csdn.net/sunjiajiang/article/details/7368684

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值