Skip to content
Snippets Groups Projects
Commit 563e84cb authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Cppcheck updated to 1.71

The new message class (information) is treated as (style).

I temporarily add two travis test to allow 1.71 to fail.
parent 8aced36a
No related branches found
No related tags found
No related merge requests found
......@@ -40,8 +40,16 @@ matrix:
env: PLUMED_CC=mpicc PLUMED_CXX=mpic++ PLUMED_CXXFLAGS=-O3
# cppcheck
- os: linux
dist: trusty
sudo: required
env: CPPCHECK=yes CPPCHECK_VERSION=1.69
- os: linux
dist: trusty
sudo: required
env: CPPCHECK=yes
env: CPPCHECK=yes CPPCHECK_VERSION=1.71
allow_failures:
# I allow this to fail temporarily
- env: CPPCHECK=yes CPPCHECK_VERSION=1.71
# Possible additional variables:
# VALGRIND=yes to make valgrind tests, only when log contains string [valgrind]
install:
......@@ -63,7 +71,8 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libmatheval-dev ; fi
- if test "$PLUMED_CXX" ; then ./.travis/install.xdrfile ; fi
# cppcheck:
- if test "$CPPCHECK" == yes ; then ./.travis/install.cppcheck 1.69 ; fi
# I use 1.71 since 1.72 seems to report a lot of false positive
- if test "$CPPCHECK" == yes ; then ./.travis/install.cppcheck $CPPCHECK_VERSION ; fi
# installation of these packages takes a lot of time
# we do it only when needed
- if test "$PLUMED_CXX" == "mpic++" -a "$TRAVIS_OS_NAME" == "linux" ; then sudo apt-get install -y libopenmpi-dev openmpi-bin ; fi
......
......@@ -26,29 +26,30 @@ echo " since they are full of warnings"
## (the "true" command is necessary so that the script does not fail if some string is not found)
cat cppcheck.log | grep -v "\[molfile/" | grep -v "\[lapack/" | grep -v "\[blas/" > cppcheck.clean || true
## Here I make a summary of the (style) messages
## Here I make a summary of the (style) and (information) messages
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo " Summary of reported (style) messages"
echo " Summary of reported (style) and (information) messages"
## (the "true" command is necessary so that the script does not fail if some string is not found)
awk '{if($2=="(style)")print $3}' cppcheck.clean | sort | uniq -c || true
awk '{if($2=="(information)")print $3}' cppcheck.clean | sort | uniq -c || true
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
## Here I also exclude (style) messages
## Here I also exclude (style) and (information) messages
## perhaps we could keep some of them to make to code cleaner at some point
## (the "true" command is necessary so that the script does not fail if some string is not found)
grep -v "(style)" cppcheck.clean > cppcheck.fatal || true
grep -v "(style)" cppcheck.clean | grep -v "(information)" > cppcheck.fatal || true
count=$(cat cppcheck.fatal | wc -l)
echo
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
if ((count==0))
then
echo " cppcheck did not find any fatal error"
echo " excluding (style)"
echo " excluding (style) and (information)"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
exit 0
fi
echo " cppcheck reported the following fatal errors:"
echo " excluding (style)"
echo " excluding (style) and (information)"
echo
cat cppcheck.fatal
echo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment