[Ksummit-discuss] coverity, static checking etc.

Wolfram Sang wsa at the-dreams.de
Wed May 14 16:36:08 UTC 2014


On Wed, May 14, 2014 at 05:44:54PM +0200, Peter Huewe wrote:
> > Ditto. I personally use 'C=1 CHECK="ninja-check"' which is a wrapper
> > which calls all static analyzers I know of.
> 
> +1 on ninja-check
> 
> Care to share your wrapper?

Here, be warned that there will be some output you need to get used to
;)


#!/bin/sh -u
# wrapper to call various static checkers for kernel builds.
# Use: make C=1 CHECK='ninja-check' ...
# done by Wolfram Sang in 2012-14, version 20140514 - WTFPLv2

check_for()
{
	command -v $1 > /dev/null
	ret=$?
	[ $ret -eq 0 ] && echo "    $1" | tr a-z A-Z
	return $ret
}

# Get filename (last argument)
eval file_to_check=\${$#}

check_for sparse && sparse -Wsparse-all "$@"

check_for smatch && smatch --project=kernel "$@" 1>&2

check_for cppcheck && cppcheck -f -q --template=gcc --enable=all --language=c "$file_to_check"

check_for spatch && MODE=report scripts/coccicheck "$file_to_check" 1>&2

check_for flawfinder && flawfinder --minlevel=0 --quiet --dataonly --singleline "$file_to_check" 1>&2

check_for rats && rats --resultsonly -w 3 "$file_to_check" 1>&2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxfoundation.org/pipermail/ksummit-discuss/attachments/20140514/9038931d/attachment.sig>


More information about the Ksummit-discuss mailing list