[splint-discuss] Running Splint for Linux drivers
Brian Quinlan
brian.quinlan at iolfree.ie
Thu Mar 6 16:23:58 PST 2008
On Thu, 2008-03-06 at 17:20 +0530, Vijayendra Suman wrote:
> Hi,
>
> I am new to splint tool, We tried to run splint on Linux drivers.
> Thanks in advance for your appreciated help !
>
> Is there any way to exclude the Linux kernel headers path when we try
> to run splint over our driver code, I mean to say if we have any
> option to exclude the linux kernel header files from getting parsed by
> the splint tool. I just wanted to check driver files with the splint
> tool. Here is the errors i got when I tried to run splint on my
> drivers.
>
> This is the Makefile for splint:
>
> CFLAGS += $(DEBFLAGS)
> CFLAGS += -I..
> CFLAGS += -I$(DEBUG_DIR_PATH)
> CFLAGS += -I$(DRIVER_DIR_PATH)
> CFLAGS += -I$(HW_DIR_PATH)
> CFLAGS += -I$(APPS_DIR_PATH)
> CFLAGS += -I$(OSDEP_PATH)
> CFLAGS += -D$(RELEASE_TYPE)
>
> SPLINTFLAGS += -I$(CFLAGS)
> SPLINTFLAGS += -I/lib/modules/`uname -r`/build/include
>
> splint:
> @$(ECHO) "Going for Splint Checking"
> @splint -weak \
> -gnuextensions \
> -macrovarprefixexclude \
> -namechecks \
> -skip-ansi-headers \
> -preproc \
> -expect 100 \
> -systemdirerrors \
> -hints \
> +trytorecover \
> +posixlib \
> $(SPLINTFLAGS) $(SRC_DIR_PATH)/slim_bus_hw.c
>
> This is the O/P I got after running running this
>
> [root at localhost build]# make splint
> Going for Splint Checking
> Splint 3.0.1.7 --- 24 Jan 2003
>
> Command Line: Setting -sysdirerrors redundant with current value
> /lib/modules/2.6.20/build/include/asm/types.h:13:24: Parse Error:
> Suspect missing struct or union keyword: __signed__ :
> unsigned short int. Attempting to continue.
> /lib/modules/2.6.20/build/include/asm/types.h:19:23: Parse Error:
> Suspect missing struct or union keyword: __signed__ :
> unsigned short int. Attempting to continue.
> /lib/modules/2.6.20/build/include/asm/types.h:19:23:
> Parse Error. Too many errors, giving up.
> *** Cannot continue.
> make: *** [splint] Error 1
>
> I have used Red Hat Linux 2.6.20 kernel for the include file
>
> --
> Regards
> Vijayendra Suman
> _______________________________________________
> splint-discuss mailing list
> splint-discuss at mail.cs.virginia.edu
> http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
Hi,
The fundamental problem is that the Linux kernel headers use gcc-
specific features that splint can't parse, so you end up having use the
preprocessor to trick splint into seeing something that it can parse.
A few years back I posted this to the list:
http://www.splint.org/pipermail/splint-discuss/2005-January/000531.html
It explains how to do what you're asking, but for a 2.4.23 kernel.
It's certainly worth trying similar things for 2.6.20, but it won't all
necessarily be plain sailing:
- It's quite likely that changes between 2.4.23 & 2.6.20 will break some
things that my original post didn't address, but the post should give
you some ideas for the kinds of things to try.
- It's also possible that there are some new problems that my approach
can't help with.
If you succeed, please post an update.
Finally, Google is your friend - the link is the first result in a
search for "Splint for Linux drivers".
Bye,
Brian
More information about the splint-discuss
mailing list