diff --git a/cfg/boost.cfg b/cfg/boost.cfg index adba92d07..1db1e3dc7 100644 --- a/cfg/boost.cfg +++ b/cfg/boost.cfg @@ -14,4 +14,10 @@ + + + + + + diff --git a/test/cfg/boost.cpp b/test/cfg/boost.cpp new file mode 100644 index 000000000..8f1e2205a --- /dev/null +++ b/test/cfg/boost.cpp @@ -0,0 +1,31 @@ + +// Test library configuration for boost.cfg +// +// Usage: +// $ cppcheck --check-library --enable=information --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/boost.cpp +// => +// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0 +// + +#include + + +BOOST_FORCEINLINE void boost_forceinline_test() +{ +} + +BOOST_NOINLINE void boost_noinline_test() +{ +} + +BOOST_NORETURN void boost_noreturn_test() +{ +} + +void valid_code() +{ + if (BOOST_LIKELY(1)) { + } + if (BOOST_UNLIKELY(0)) { + } +} diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index b4b6ba7f3..ab9e19050 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -126,6 +126,19 @@ else fi ${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=gtk -f ${DIR}gtk.c +# boost.cpp +set +e +echo -e "#include " | ${CXX} ${CXX_OPT} -x c++ - +BOOSTCHECK_RETURNCODE=$? +set -e +if [ ${BOOSTCHECK_RETURNCODE} -ne 0 ]; then + echo "Boost not completely present or not working, skipping syntax check with ${CXX}." +else + echo "Boost found and working, checking syntax with ${CXX} now." + ${CXX} ${CXX_OPT} ${DIR}boost.cpp +fi +${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=boost ${DIR}boost.cpp + # Check the syntax of the defines in the configuration files set +e xmlstarlet --version