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