diff --git a/.travis.yml b/.travis.yml index fbc51cf8b..4125525da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ env: before_install: # install needed deps - travis_retry sudo apt-get update -qq - - travis_retry sudo apt-get install -qq python-pygments python3-pip qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev + - travis_retry sudo apt-get install -qq python-pygments python3-pip qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev # Python 2 modules - travis_retry python2 -m pip install --user pytest==4.6.4 - travis_retry python2 -m pip install --user pylint diff --git a/cfg/libsigc++.cfg b/cfg/libsigc++.cfg new file mode 100644 index 000000000..f03804fa8 --- /dev/null +++ b/cfg/libsigc++.cfg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + false + + + + + diff --git a/test/cfg/libsigc++.cpp b/test/cfg/libsigc++.cpp new file mode 100644 index 000000000..f8989e7d5 --- /dev/null +++ b/test/cfg/libsigc++.cpp @@ -0,0 +1,28 @@ + +// Test library configuration for libsigc++.cfg +// +// Usage: +// $ cppcheck --check-library --enable=information --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/libsigc++.cpp +// => +// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0 +// + +#include + +struct struct1 : public sigc::trackable { + void func1(int) const {} +}; + +void valid_code() +{ + const struct1 my_sruct1; + sigc::slot sl = sigc::mem_fun(my_sruct1, &struct1::func1); + if (sl) {} +} + +void ignoredReturnValue() +{ + const struct1 my_sruct1; + // cppcheck-suppress ignoredReturnValue + sigc::mem_fun(my_sruct1, &struct1::func1); +} diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index 8564a195f..95d593bdc 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -311,6 +311,33 @@ else fi ${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=kde ${DIR}kde.cpp +# libsigc++.cpp +set +e +pkg-config --version +PKGCONFIG_RETURNCODE=$? +set -e +if [ $PKGCONFIG_RETURNCODE -ne 0 ]; then + echo "pkg-config needed to retrieve libsigc++ configuration is not available, skipping syntax check." +else + set +e + LIBSIGCPPCONFIG=$(pkg-config --cflags sigc++-2.0) + LIBSIGCPPCONFIG_RETURNCODE=$? + set -e + if [ $LIBSIGCPPCONFIG_RETURNCODE -eq 0 ]; then + set +e + echo -e "#include \n" | ${CXX} ${CXX_OPT} ${LIBSIGCPPCONFIG} -x c++ - + LIBSIGCPPCONFIG_RETURNCODE=$? + set -e + if [ $LIBSIGCPPCONFIG_RETURNCODE -ne 0 ]; then + echo "libsigc++ not completely present or not working, skipping syntax check with ${CXX}." + else + echo "libsigc++ found and working, checking syntax with ${CXX} now." + ${CXX} ${CXX_OPT} ${LIBSIGCPPCONFIG} ${DIR}libsigc++.cpp + fi + fi +fi +${CPPCHECK} ${CPPCHECK_OPT} --library=libsigc++ ${DIR}libsigc++.cpp + # Check the syntax of the defines in the configuration files set +e xmlstarlet --version diff --git a/tools/donate_cpu_lib.py b/tools/donate_cpu_lib.py index 5a901bda3..34b130005 100644 --- a/tools/donate_cpu_lib.py +++ b/tools/donate_cpu_lib.py @@ -446,6 +446,7 @@ def get_libraries(): # 'kde': ['', '', ''], 'libcurl': [''], + # 'libsigc++': ['', '"lua.h"'], 'microsoft_sal': [''], 'motif': ['