Skip to content

Commit

Permalink
AVRO-2813: Add cppcheck as a C++ linter (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
sekikn committed Apr 26, 2020
1 parent b6f4970 commit f56cafb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ do
(cd lang/py && ./build.sh lint test)
(cd lang/py3 && ./build.sh lint test)
(cd lang/c; ./build.sh test)
(cd lang/c++; ./build.sh test)
(cd lang/c++; ./build.sh lint test)
(cd lang/csharp; ./build.sh test)
(cd lang/js; ./build.sh lint test)
(cd lang/ruby; ./build.sh lint test)
Expand Down
4 changes: 3 additions & 1 deletion lang/c++/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ do

case "$target" in
lint)
echo 'This is a stub where someone can provide linting.'
# some versions of cppcheck seem to require an explicit
# "--error-exitcode" option to return non-zero code
cppcheck --error-exitcode=1 --inline-suppr -f -q -x c++ .
;;

test)
Expand Down
2 changes: 2 additions & 0 deletions lang/c++/impl/Zigzag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace avro {
uint64_t
encodeZigzag64(int64_t input)
{
// cppcheck-suppress shiftTooManyBitsSigned
return ((input << 1) ^ (input >> 63));
}

Expand All @@ -36,6 +37,7 @@ decodeZigzag64(uint64_t input)
uint32_t
encodeZigzag32(int32_t input)
{
// cppcheck-suppress shiftTooManyBitsSigned
return ((input << 1) ^ (input >> 31));
}

Expand Down
1 change: 1 addition & 0 deletions share/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ RUN apt-get -qqy update \
bzip2 \
bundler \
cmake \
cppcheck \
curl \
doxygen \
flex \
Expand Down

0 comments on commit f56cafb

Please sign in to comment.