[splint-discuss] Running Splint on entire project (util script)
Jake Holland
JHolland at FASTSOFT.COM
Mon Jan 12 11:44:05 PST 2009
I did it in the makefile. We had an extra couple of system includes,
which was kind of a hassle, and I suspect could be done better than what
I've got, but it works for gmake.
But thanks for posting, and I'd be interested to hear more ways people
folded splint into their process. (Especially if anybody's done it with
scons, which I'd love to switch to.)
And here's a working makefile that's a little bit like my real ones:
ALL_DEFS := -DWHATEVER
SYSTEM_INC := dir1 dir2
INCLUDE := dir3 dir4
SRC := prog.c x.c
#some multi-platform if clauses that do INCLUDE += xx
#(inside a if clause to optionally set it to empty)
SPLINT_CMD = splint -f splint.opt $(ALL_DEFS) $(ALL_SPLINT_INC) -I$(<D)
$<
empty:=
space:= $(empty) $(empty)
ALL_SPLINT_INC := -systemdirs "$(subst $(space),:,$(SYSTEM_INC))"
$(SYSTEM_INC:%=-I%) $(INCLUDE:%=-I%)
ALL_GCC_INC := $(SYSTEM_INC:%=-isystem %) $(INCLUDE:%=-I%)
prog: $(SRC:%.c=%.o)
$(CC) -o $@ $(ALL_CFLAGS) $(SRC:%.c=%.o) $(LIBDIR) $(LIBS)
DEP = $(SRC:%.c=%.d)
-include $(DEP)
%.o: %.c
gcc -M -MP $(ALL_CFLAGS) $(ALL_DEFS) $(ALL_GCC_INC) -I$(<D) $< >
$(@:%.o=%.d)
$(SPLINT_CMD)
gcc -c -o $@ $(ALL_CFLAGS) $(ALL_DEFS) $(ALL_GCC_INC) -I$(<D) $<
-----Original Message-----
From: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of Campbell
Barton
Sent: Saturday, December 20, 2008 6:53 PM
To: splint-discuss at mail.cs.virginia.edu
Subject: [splint-discuss] Running Splint on entire project (util script)
Hi there, thanks for splint!
Just used it to fix a bug over 10 years old :)
To use splint on many files I wrote a util that could be of use to
others (or I might have re-invented the wheel :/)
I wanted to run splint on all C files in Blender3D, ~1973 of them, but
getting the includes right for each file is annoying.
So I wrote a simple python script that parses the output of a clean
build and runs splint on every C file.
"gcc -o blah.o -O2 -I/myinclude some.c"
... looks for the -I* and *.c itens and runs
"splint -I/myinclude some.c"
Tested it to work with python and pygame also
http://wiki.blender.org/index.php/User:Ideasman42#Using_Splint_Static_C_
Source_Checking
Would be interested to know if there are better tools, or if others
find this useful.
--
- Campbell
_______________________________________________
splint-discuss mailing list
splint-discuss at mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.9.19/1855 - Release Date:
12/19/2008 10:09 AM
More information about the splint-discuss
mailing list