blob: 08cb6726360ce021300332aacbef2d59908f80c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/bash
# This script performs a single analysis using cppcheck
# It is used by the 'make test' target in the buildsystems
# Usually you should use 'ctest -C cppcheck' rather than calling this script directly
#
# Parameters: $1 = Application binary
# $2 = Source file to process
# $3..$N = include path parameters (-I dir1 -I dir2 ...)
cppcheck_cmd=$1
source_file=$2
shift 2
tmpfil=`mktemp`
$cppcheck_cmd $@ --force --enable=all --suppress=unusedFunction $source_file &> $tmpfil
nmatch=`cat $tmpfil | grep "\[.*\]" | wc -l`
nnone=`cat $tmpfil | grep "\[\\*]" | wc -l`
let "nval=$nmatch-$nnone"
if test $nval -gt 0
then
cat $tmpfil
rm $tmpfil
exit 1
fi
rm $tmpfil
exit 0
|