Boost configuration: Add macros and initial test file (#1575)

This commit is contained in:
Sebastian 2019-01-08 20:30:21 +01:00 committed by GitHub
parent 58b8cef822
commit 0aa4910244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 0 deletions

View File

@ -14,4 +14,10 @@
<not-null/>
</arg>
</function>
<!-- https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html -->
<define name="BOOST_FORCEINLINE" value="inline"/>
<define name="BOOST_NOINLINE" value=""/>
<define name="BOOST_NORETURN" value="[[noreturn]]"/>
<define name="BOOST_LIKELY(X)" value="(X)"/>
<define name="BOOST_UNLIKELY(X)" value="(X)"/>
</def>

31
test/cfg/boost.cpp Normal file
View File

@ -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/config.hpp>
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)) {
}
}

View File

@ -126,6 +126,19 @@ else
fi
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=gtk -f ${DIR}gtk.c
# boost.cpp
set +e
echo -e "#include <boost/config.hpp>" | ${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