libsigc++.cfg: Add configuration for library libsigc++ (#2291)

* libsigc++.cfg: Add configuration for library libsigc++

Reference: https://libsigcplusplus.github.io/libsigcplusplus/

* Make code compatible with libsigc++-2.0 instead of 3.0

Since Version 3.0 C++14 is required which is not (fully) supported in
some older GCC versions.
This commit is contained in:
Sebastian 2019-10-26 17:37:14 +02:00 committed by GitHub
parent 224ae3c326
commit 8fb794e731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 93 additions and 1 deletions

View File

@ -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

36
cfg/libsigc++.cfg Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<def format="2">
<!-- libsigc++ Library Configuration https://libsigcplusplus.github.io/libsigcplusplus/ -->
<!-- On GitHub: https://github.com/libsigcplusplus/libsigcplusplus -->
<!-- Typically included via: "#include <sigc++/sigc++.h>" -->
<!-- ########## libsigc++ Types ########## -->
<!-- ########## libsigc++ Macros / Defines ########## -->
<!-- ########## libsigc++ Allocation / Deallocation ########## -->
<!-- ########## libsigc++ Functions ########## -->
<!-- sigc::mem_fun for libsigc++ 2.0: -->
<!-- template<class T_return , class T_obj >
mem_functor0< T_return, T_obj > sigc::mem_fun (T_return(T_obj::* _A_func)()) -->
<!-- template<class T_arg1 , class T_return , class T_obj >
mem_functor1< T_return, T_obj, T_arg1 > sigc::mem_fun (T_return(T_obj::* _A_func)(T_arg1)) -->
<!-- template<class T_arg1 , class T_arg2 , class T_return , class T_obj >
mem_functor2< T_return, T_obj, T_arg1, T_arg2 > sigc::mem_fun (T_return(T_obj::* _A_func)(T_arg1, T_arg2)) -->
<!-- and so on, until:
template<class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 , class T_arg7 , class T_return , class T_obj >
mem_functor7< T_return, T_obj, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > sigc::mem_fun (T_return(T_obj::* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7)) -->
<!-- template<class T_return , class T_obj , class T_obj2 >
bound_mem_functor0< T_return, T_obj > sigc::mem_fun (T_obj* _A_obj, T_return(T_obj2::* _A_func)()) -->
<!-- and so on, until:
template<class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 , class T_arg7 , class T_return , class T_obj , class T_obj2 >
bound_mem_functor7< T_return, T_obj, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > sigc::mem_fun (T_obj& _A_obj, T_return(T_obj2::* _A_func)(T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7)) -->
<!-- sigc::mem_fun since libsigc++ 3.0 -->
<!-- template<typename T_return , typename T_obj , typename... T_arg>
decltype(auto) sigc::mem_fun (T_return(T_obj::* func)(T_arg...)) -->
<!-- template<typename T_return , typename T_obj , typename T_obj2 , typename... T_arg>
decltype(auto) sigc::mem_fun (T_obj& obj, T_return(T_obj2::* func)(T_arg...)) -->
<function name="sigc::mem_fun">
<noreturn>false</noreturn>
<use-retval/>
<arg nr="1"/>
<arg nr="2" default=""/>
</function>
</def>

28
test/cfg/libsigc++.cpp Normal file
View File

@ -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 <sigc++/sigc++.h>
struct struct1 : public sigc::trackable {
void func1(int) const {}
};
void valid_code()
{
const struct1 my_sruct1;
sigc::slot<void, int> 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);
}

View File

@ -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 <sigc++/sigc++.h>\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

View File

@ -446,6 +446,7 @@ def get_libraries():
# 'kde': ['<KGlobal>', '<KApplication>', '<KDE/'], <= enable after release of version 1.90
'libcerror': ['<libcerror.h>'],
'libcurl': ['<curl/curl.h>'],
# 'libsigc++': ['<sigc++/'], <= enable after release of version 1.90
'lua': ['<lua.h>', '"lua.h"'],
'microsoft_sal': ['<sal.h>'],
'motif': ['<X11/', '<Xm/'],