fixes for cppcheck lint warnings

Refine the linting behavior.

Fix several of the, mostly trivial, lint errors.
This commit is contained in:
Kurtis Rader
2016-04-04 14:34:28 -07:00
parent 0953590cca
commit 47f1a92cc4
9 changed files with 51 additions and 49 deletions

View File

@@ -57,8 +57,14 @@ if set -q c_files[1]
echo ========================================
echo Running cppcheck
echo ========================================
# The stderr to stdout redirection is because cppcheck, incorrectly
# IMHO, writes its diagnostic messages to stderr. Anyone running
# this who wants to capture its output will expect those messages to be
# written to stdout.
cppcheck -q --verbose --std=posix --std=c11 --language=c++ \
--inline-suppr --enable=$cppchecks $cppcheck_args $c_files
--template "[{file}:{line}]: {severity} ({id}): {message}" \
--suppress=missingIncludeSystem \
--inline-suppr --enable=$cppchecks $cppcheck_args $c_files 2>&1
end
if type -q oclint
@@ -66,6 +72,10 @@ if set -q c_files[1]
echo ========================================
echo Running oclint
echo ========================================
# The stderr to stdout redirection is because oclint, incorrectly
# writes its final summary counts of the errors detected to stderr.
# Anyone running this who wants to capture its output will expect those
# messages to be written to stdout.
if test (uname -s) = "Darwin"
if not test -f compile_commands.json
xcodebuild > xcodebuild.log
@@ -73,19 +83,19 @@ if set -q c_files[1]
end
if test $all = yes
oclint-json-compilation-database -e '/pcre2-10.20/' \
-- -enable-global-analysis
-- -enable-global-analysis 2>&1
else
set i_files
for f in $c_files
set i_files $i_files -i $f
end
echo oclint-json-compilation-database -e '/pcre2-10.20/' $i_files
oclint-json-compilation-database -e '/pcre2-10.20/' $i_files
oclint-json-compilation-database -e '/pcre2-10.20/' $i_files 2>&1
end
else
# Presumably we're on Linux or other platform not requiring special
# handling for oclint to work.
oclint $c_files -- $argv
oclint $c_files -- $argv 2>&1
end
end
else