麒麟系统安装splint

1.登陆splint官网下载原码http://www.splint.org/download.html

这里要注意:由于机器是mips所以选择上面的原码自行编译

2.tar -xzf splint-3.1.2.src.tgz

sudo ./configure –prefix=/usr/local/splint

sudo make

sudo make install

3.修改配置文件

#vi ~/.bashrc

最后一行加上:

LARCH_PATH=/usr/local/splint/share/splint/lib
LCLIMPORTDIR=/usr/splint/share/splint/imports

#source ~/.bashrc

# exprot PATH=/usr/local/splint/bin/splint:$PATH

4.验证

#vi null.c

输入:

//null.c
char firstChar1 (/*@null@*/ char *s)

 {
return *s;


char firstChar2 (/*@null@*/ char *s)

 {
 if (s ==NULL) return '\0';  return *s;

}

//END

用splint扫面:#splint null.c

Splint 3.1.1 --- 28 Apr 2005
null.c: (in function firstChar1)
null.c:3:11: Dereference of possibly null pointer s: *s   null.c:1:35: Storage s may become null Finished checking --- 1 code warning found
由于firstChar1和firstChar2都使用了null说明,表示指针s可能是个NULL值.
所以,splint会对s值的使用情况进行检查.因为firstChar2函数中,对s的值进行
了NULL的判断.所以,没有对firstChar2函数的指针s输出警告信息.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值