2017-09-07 21:09:58 +00:00
|
|
|
# Install cppcheck
|
|
|
|
|
|
|
|
mkdir cppcheck && cd cppcheck
|
|
|
|
git clone git@github.com:danmar/cppcheck.git .
|
|
|
|
mkdir build && cd build
|
|
|
|
CC=gcc-7 CXX=g++-7 cmake -D CMAKE_BUILD_TYPE=Release ..
|
|
|
|
make -j24
|
|
|
|
sudo make install
|
|
|
|
|
|
|
|
# Perform analysis
|
2017-09-07 21:26:25 +00:00
|
|
|
# cd ClickHouse_clean/build
|
2017-09-07 21:09:58 +00:00
|
|
|
|
2017-09-07 21:26:25 +00:00
|
|
|
cppcheck -j24 --project=compile_commands.json --enable=all 2> cppcheck-errors.txt
|
2017-09-07 21:35:21 +00:00
|
|
|
# or
|
|
|
|
# cppcheck -j24 -i contrib -i build --enable=all . 2> cppcheck-errors.txt
|
2017-09-07 21:09:58 +00:00
|
|
|
|
|
|
|
# Check is pretty fast.
|
2017-09-07 21:26:25 +00:00
|
|
|
# It gives many false positives.
|
2017-09-07 21:09:58 +00:00
|
|
|
# But the result is worth looking and at least few real errors found.
|
2017-09-07 21:26:25 +00:00
|
|
|
|
|
|
|
grep -v -F 'contrib/' cppcheck-errors.txt
|