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、? 配置,打開當(dāng)前的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
?
?
參考文獻(xiàn):
1、? http://www.splint.org/
2、? http://blog.csdn.net/sunjiajiang/article/details/7368684
?
總結(jié)
以上是生活随笔為你收集整理的Ubuntu中C代码静态检查工具Splint的安装配置和使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tesseract-ocr3.02字符识
- 下一篇: C/C++代码静态检查工具PC-lint