Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638730

Re: sparse on scripts/kconfig/*.c

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: sparse on scripts/kconfig/*.c
Date 2017-05-10 12:20 +0200
Message-ID <tFwSS-7SQ-9@gated-at.bofh.it> (permalink)
References <tFguJ-4li-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, May 09, 2017 at 09:47:41AM -0700, Randy Dunlap wrote:
> Hi,
> 
> I've been attempting to run sparse on the kconfig/ C files -- without success.
> 
> The kbuild files don't try to support CHECK in scripts/kconfig/ AFAICT,
> and just running sparse on the C files has issues with not being able to
> find header files.
> 
> Has anyone done this?  Any clues about how to do it?
> 

Smatch has pretty much only been used on kernel code, and it really
shows.  For userspace code, you'd want to make a list of the no return
functions and some other customizations.  Also the kernel uses a quite
limitted sample of C.

Anyway, what Christophe said is right.  Change the Makefile:
-HOSTCC       = gcc
+HOSTCC       = ~/progs/smatch/devel/cgcc

make CHECK="~/progs/smatch/devel/smatch --file-output" scripts/kconfig/
find -name \*.c.smatch -exec cat \{\} \; > smatch_warns.txt

I just did that now, and there is nothing interesting there.  If there
were something there, then there is a good chance I would have seen it
already because I've been running smatch_scripts/kchecker on every .c
file.  Say you don't have your .config set up for sparc then it doesn't
really work great, but what it does it uses the x86 headers but if there
are any header files missing it just includes a promising header with
the same name or it continues without the .h file.  The output is mostly
garbage but I had five sparc patches merged in 2016 so I'm a top ten
sparc dev for the year.  :P

regards,
dan carpenter

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

sparse on scripts/kconfig/*.c Randy Dunlap <rdunlap@infradead.org> - 2017-05-09 18:50 +0200
  Re: sparse on scripts/kconfig/*.c Christoph Hellwig <hch@infradead.org> - 2017-05-09 22:20 +0200
    Re: sparse on scripts/kconfig/*.c Randy Dunlap <rdunlap@infradead.org> - 2017-05-10 02:30 +0200
      Re: sparse on scripts/kconfig/*.c Christoph Hellwig <hch@infradead.org> - 2017-05-10 09:30 +0200
        Re: sparse on scripts/kconfig/*.c Randy Dunlap <rdunlap@infradead.org> - 2017-05-10 18:50 +0200
  Re: sparse on scripts/kconfig/*.c Dan Carpenter <dan.carpenter@oracle.com> - 2017-05-10 12:20 +0200
    Re: sparse on scripts/kconfig/*.c Dan Carpenter <dan.carpenter@oracle.com> - 2017-05-10 23:00 +0200

csiph-web