diff --git a/.travis.yml b/.travis.yml index c64de44c71a311a3d7e6d29c83f07d5a2a918ec9..b5b78666914019e766652e95b984cc7f2459d7ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/src/maketools/cppcheck b/src/maketools/cppcheck index d83b820c92e7126579b0928271e977c9249e47bc..e851636616bc33c869ec377c47880377ba1c6431 100755 --- a/src/maketools/cppcheck +++ b/src/maketools/cppcheck @@ -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