diff options
author | Evan Huus <eapache@gmail.com> | 2012-07-18 02:30:35 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2012-07-18 02:30:35 +0000 |
commit | 6e8258be9a7d525eb5ec00335dff7d025496bd73 (patch) | |
tree | 5f12a760e9bd295f7b61fba993eac87c094ea460 /tools | |
parent | c0a913afda4f3aa4f1928b0d8bce8f635b54212b (diff) |
Add basic CppCheck configuration and runner.
Probably subject to change as it gets integrated into the build-bot.
svn path=/trunk/; revision=43778
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/cppcheck/cppcheck.sh | 59 | ||||
-rw-r--r-- | tools/cppcheck/includes | 5 | ||||
-rw-r--r-- | tools/cppcheck/suppressions | 4 |
3 files changed, 68 insertions, 0 deletions
diff --git a/tools/cppcheck/cppcheck.sh b/tools/cppcheck/cppcheck.sh new file mode 100755 index 0000000000..c38726e58e --- /dev/null +++ b/tools/cppcheck/cppcheck.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +# +# cppcheck.sh +# Script to run CppCheck Static Analyzer. +# http://cppcheck.sourceforge.net/ +# +# $Id$ +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# Copyright 2012 Gerald Combs +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +CUR_DIRECTORY="`dirname $0`" +ORIGINAL_DIR="`pwd`" +CPPCHECK_DIR="./tools/cppcheck" + +CPPCHECK=`which cppcheck` + +THREADS=4 +SUPPRESSIONS="$CPPCHECK_DIR/suppressions" +INCLUDES="$CPPCHECK_DIR/includes" +TEMPLATE="<tr><td>{file}</td><td>{line}</td><td>{severity}</td><td>{message}</td><td>{id}</td></tr>" + +# Use a little-documented feature of the shell to pass SIGINTs only to the +# child process (cppcheck in this case). That way the final 'echo' still +# runs and we aren't left with broken HTML. +trap : INT + +cd $CUR_DIRECTORY/../.. + +echo "<html><body><table border=1>" +echo "<tr><th>File</th><th>Line</th><th>Severity</th>" +echo "<th>Message</th><th>ID</th></tr>" + +$CPPCHECK --quiet --force --enable=style \ + --suppressions-list=$SUPPRESSIONS \ + --includes-file=$INCLUDES \ + --template=$TEMPLATE \ + -j $THREADS . 2>&1 + +echo "</table></body></html>" + +cd $ORIGINAL_DIR diff --git a/tools/cppcheck/includes b/tools/cppcheck/includes new file mode 100644 index 0000000000..99edc71f29 --- /dev/null +++ b/tools/cppcheck/includes @@ -0,0 +1,5 @@ +./epan/ +./epan/dissectors/ +./tools/lemon/ +./ui/ +./wiretap/ diff --git a/tools/cppcheck/suppressions b/tools/cppcheck/suppressions new file mode 100644 index 0000000000..ca7dfe0124 --- /dev/null +++ b/tools/cppcheck/suppressions @@ -0,0 +1,4 @@ +variableScope +duplicateExpression +invalidscanf +noConstructor |