cppcheck.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #! /bin/bash
  2. #
  3. # Copyright 2018 James E. King III
  4. # Distributed under the Boost Software License, Version 1.0.
  5. # (See accompanying file LICENSE_1_0.txt or copy at
  6. # http://www.boost.org/LICENSE_1_0.txt)
  7. #
  8. # Bash script to run in travis to perform a cppcheck
  9. # cwd should be $BOOST_ROOT before running
  10. #
  11. set -ex
  12. # default language level: c++03
  13. if [[ -z "$CXXSTD" ]]; then
  14. CXXSTD=03
  15. fi
  16. # Travis' ubuntu-trusty comes with cppcheck 1.62 which is pretty old
  17. # default cppcheck version: 1.82
  18. if [[ -z "$CPPCHKVER" ]]; then
  19. CPPCHKVER=1.82
  20. fi
  21. pushd ~
  22. wget https://github.com/danmar/cppcheck/archive/$CPPCHKVER.tar.gz
  23. tar xzf $CPPCHKVER.tar.gz
  24. mkdir cppcheck-build
  25. cd cppcheck-build
  26. cmake ../cppcheck-$CPPCHKVER -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=~/cppcheck
  27. make -j3 install
  28. popd
  29. ~/cppcheck/bin/cppcheck -I. --std=c++$CXXSTD --enable=all --error-exitcode=1 \
  30. --force --check-config --suppress=*:boost/preprocessor/tuple/size.hpp \
  31. -UBOOST_USER_CONFIG -UBOOST_COMPILER_CONFIG -UBOOST_STDLIB_CONFIG -UBOOST_PLATFORM_CONFIG \
  32. libs/$SELF 2>&1 | grep -v 'Cppcheck does not need standard library headers'