aboutsummaryrefslogtreecommitdiffhomepage
path: root/build_tools
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-04-04 14:34:28 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-04-04 14:34:28 -0700
commit47f1a92cc4c3c7056f4172974f10a8dd402cf55c (patch)
tree34bf83341006081f8a07bc6ca77cac03c603eb97 /build_tools
parent0953590cca7cdc2dab75af5a85c8e2f15d4b8ab2 (diff)
fixes for cppcheck lint warnings
Refine the linting behavior. Fix several of the, mostly trivial, lint errors.
Diffstat (limited to 'build_tools')
-rwxr-xr-xbuild_tools/lint.fish18
1 files changed, 14 insertions, 4 deletions
diff --git a/build_tools/lint.fish b/build_tools/lint.fish
index 3fd90b24..09ab6f46 100755
--- a/build_tools/lint.fish
+++ b/build_tools/lint.fish
@@ -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