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 12set -ex 13 14# default language level: c++03 15if [[ -z "$CXXSTD" ]]; then 16 CXXSTD=03 17fi 18 19# Travis' ubuntu-trusty comes with cppcheck 1.62 which is pretty old 20# default cppcheck version: 1.82 21if [[ -z "$CPPCHKVER" ]]; then 22 CPPCHKVER=1.82 23fi 24 25pushd ~ 26wget https://github.com/danmar/cppcheck/archive/$CPPCHKVER.tar.gz 27tar xzf $CPPCHKVER.tar.gz 28mkdir cppcheck-build 29cd cppcheck-build 30cmake ../cppcheck-$CPPCHKVER -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=~/cppcheck 31make -j3 install 32popd 33 34~/cppcheck/bin/cppcheck -I. --std=c++$CXXSTD --enable=all --error-exitcode=1 \ 35 --force --check-config --suppress=*:boost/preprocessor/tuple/size.hpp \ 36 -UBOOST_USER_CONFIG -UBOOST_COMPILER_CONFIG -UBOOST_STDLIB_CONFIG -UBOOST_PLATFORM_CONFIG \ 37 libs/$SELF 2>&1 | grep -v 'Cppcheck does not need standard library headers' 38 39