boost.cfg: Add argument directions; some fixes; rearrange and document.

- Remove redundant function configurations for the same function since
it is not (yet) possible to configure overloaded functions. Instead mark
the optional arguments with `default="0"` so the configuration works
with a different number of arguments.
- Add documentation to boost.cfg (links and function declarations).
- Rearranged configurations so functions, defines, ... are together now.
- Add `direction` for function arguments where applicable.
- Add some tests to boost.cpp.
This commit is contained in:
versat 2019-03-15 11:13:08 +01:00
parent 08d41ab8af
commit 6f7612de03
2 changed files with 250 additions and 145 deletions

View File

@ -1,19 +1,8 @@
<?xml version="1.0"?>
<def format="2">
<function name="boost::algorithm::join">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2">
<not-uninit/>
<not-null/>
</arg>
</function>
<!-- Boost Library Configuration -->
<!-- Documentation: https://www.boost.org/doc/libs/ -->
<!-- ########## Boost defines / macros ########## -->
<!-- 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=""/>
@ -35,41 +24,80 @@
<define name="BOOST_WARN_EQUAL(a,b)" value="assert((a) == (b))"/>
<define name="BOOST_REQUIRE_EQUAL(a,b)" value="assert((a) == (b))"/>
<define name="BOOST_LOG_ATTRIBUTE_KEYWORD(keyword, name_, value_type_)" value="value_type_ keyword;"/>
<!-- Tell cppcheck to interpret BOOST_AUTO_TEST_CASE as a function definition -->
<define name="BOOST_AUTO_TEST_CASE(str)" value="void BOOST_AUTO_TEST_CASE_run(str)"/>
<define name="BOOST_FIXTURE_TEST_CASE(str1, str2)" value="void BOOST_FIXTURE_TEST_CASE_run(str1,str2)"/>
<define name="BOOST_PYTHON_MODULE(str)" value="void BOOST_PYTHON_MODULE_definition(str)"/>
<!-- ########## Boost containers ########## -->
<!-- boost containers that are similar to std containers -->
<container id="boostArray" startPattern="boost :: array|scoped_array &lt;" inherits="stdArray"/>
<container id="boostCircularBuffer" startPattern="boost :: circular_buffer &lt;" inherits="stdContainer"/>
<container id="boostList" startPattern="boost :: list|slist &lt;" inherits="stdList"/>
<container id="boostMap" startPattern="boost :: map|flat_map|flat_multimap|multimap|unordered_map|unordered_multimap &lt;" inherits="stdMap"/>
<container id="boostSet" startPattern="boost :: set|flat_set|flat_multiset|multiset|unordered_set &lt;" inherits="stdSet"/>
<container id="boostVectorDeque" startPattern="boost :: deque|vector|small_vector|stable_vector|static_vector &lt;" inherits="stdVectorDeque"/>
<!-- ########## Boost functions ########## -->
<!-- https://www.boost.org/doc/libs/1_69_0/doc/html/boost/algorithm/join.html -->
<!-- template<typename SequenceSequenceT, typename Range1T>
range_value< SequenceSequenceT >::type join(const SequenceSequenceT & Input, const Range1T & Separator); -->
<function name="boost::algorithm::join">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-null/>
</arg>
</function>
<!-- boost::math classification functions -->
<!-- https://www.boost.org/doc/libs/1_69_0/libs/math/doc/html/math_toolkit/fpclass.html -->
<!-- template <class T> int fpclassify(T t); -->
<function name="boost::math::fpclassify">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="int"/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<function name="boost::math::isinfinite,boost::math::isinf,boost::math::isnan,boost::math::isnormal">
<!-- template <class T> bool isfinite(T z); -->
<!-- template <class T> bool isinf(T t); -->
<!-- template <class T> bool isnan(T t); -->
<!-- template <class T> bool isnormal(T t); -->
<function name="boost::math::isfinite,boost::math::isinf,boost::math::isnan,boost::math::isnormal">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="bool"/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- boost::math sign functions -->
<!-- https://www.boost.org/doc/libs/1_69_0/libs/math/doc/html/math_toolkit/sign_functions.html -->
<!-- template <class T> int sign (const T& z); -->
<function name="boost::math::sign">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="int">arg1==0?0:(arg1&lt;0?-1:1)</returnValue>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- template<class T> int signbit(T x); -->
<function name="boost::math::signbit">
<noreturn>false</noreturn>
<use-retval/>
@ -81,28 +109,34 @@
<not-bool/>
</arg>
</function>
<!-- template <class T, class U> calculated-result-type copysign (const T& x, const U& y); -->
<function name="boost::math::copysign">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2">
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- template <class T> inline T changesign (const T& z); -->
<function name="boost::math::changesign">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- boost::math constants -->
<function name="boost::math::constants::name">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue>x</returnValue>
</function>
<!-- https://www.boost.org/doc/libs/1_69_0/libs/math/doc/html/math_toolkit/constants.html -->
<function name="boost::math::constants::half">
<noreturn>false</noreturn>
<use-retval/>
@ -580,261 +614,303 @@
<returnValue>7.978845608028653558798921198687637369e-01</returnValue>
</function>
<!-- boost::math rounding functions -->
<!-- https://www.boost.org/doc/libs/1_69_0/libs/math/doc/html/math_toolkit/rounding/round.html -->
<!-- template <class T> T round(const T& v); -->
<!-- template <class T, class Policy> T round(const T& v, const Policy&); -->
<function name="boost::math::round">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" default="0" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- template <class T> int iround(const T& v); -->
<!-- template <class T, class Policy> int iround(const T& v, const Policy&); -->
<function name="boost::math::iround">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="int"/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" default="0" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- template <class T> long lround(const T& v); -->
<!-- template <class T, class Policy> long lround(const T& v, const Policy&); -->
<function name="boost::math::lround">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="long int"/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" default="0" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- template <class T> long long llround(const T& v); -->
<!-- template <class T, class Policy> long long llround(const T& v, const Policy&); -->
<function name="boost::math::llround">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="long long int"/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" default="0" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- boost::filesystem query functions -->
<!-- https://www.boost.org/doc/libs/1_69_0/libs/filesystem/doc/reference.html -->
<!-- bool exists(file_status s) noexcept; -->
<!-- bool exists(const path& p); -->
<!-- bool exists(const path& p, system::error_code& ec) noexcept; -->
<!-- bool is_directory(file_status s) noexcept; -->
<!-- bool is_directory(const path& p); -->
<!-- bool is_directory(const path& p, system::error_code& ec) noexcept; -->
<!-- The other functions are similar ... -->
<function name="boost::filesystem::exists,boost::filesystem::is_directory,boost::filesystem::is_empty,boost::filesystem::is_other,boost::filesystem::is_regular_file,boost::filesystem::is_symlink">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="bool"/>
<arg nr="1">
<not-uninit/>
</arg>
</function>
<function name="boost::filesystem::exists,boost::filesystem::is_directory,boost::filesystem::is_empty,boost::filesystem::is_other,boost::filesystem::is_regular_file,boost::filesystem::is_symlink">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="bool"/>
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" default="0" direction="out">
<not-bool/>
</arg>
</function>
<!-- bool equivalent(const path& p1, const path& p2); -->
<!-- bool equivalent(const path& p1, const path& p2, system::error_code& ec); -->
<function name="boost::filesystem::equivalent">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="bool"/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2">
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<function name="boost::filesystem::equivalent">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<returnValue type="bool"/>
<arg nr="1">
<not-uninit/>
<arg nr="3" default="0" direction="out">
<not-bool/>
</arg>
<arg nr="2">
<not-uninit/>
</arg>
<arg nr="3"/>
</function>
<!-- boost::filesystem actions -->
<function name="boost::filesystem::remove,boost::filesystem::remove_all">
<!-- bool remove(const path& p); -->
<!-- bool remove(const path& p, system::error_code& ec); -->
<function name="boost::filesystem::remove">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<returnValue type="bool"/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" default="0" direction="out">
<not-bool/>
</arg>
</function>
<function name="boost::filesystem::remove,boost::filesystem::remove_all">
<!-- uintmax_t remove_all(const path& p); -->
<!-- uintmax_t remove_all(const path& p, system::error_code& ec); -->
<function name="boost::filesystem::remove_all">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<returnValue type="bool"/>
<arg nr="1">
<returnValue type="uintmax_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2">
<not-uninit/>
<arg nr="2" default="0" direction="out">
<not-bool/>
</arg>
</function>
<function name="boost::filesystem::copy,boost::filesystem::copy_directory,boost::filesystem::copy_file,boost::filesystem::copy_symlinks">
<!-- void copy(const path& from, const path& to); -->
<!-- void copy(const path& from, const path& to, system::error_code& ec); -->
<!-- void copy_directory(const path& from, const path& to); -->
<!-- void copy_directory(const path& from, const path& to, system::error_code& ec); -->
<!-- void copy_symlink(const path& existing_symlink, const path& new_symlink); -->
<!-- void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec); -->
<function name="boost::filesystem::copy,boost::filesystem::copy_directory,boost::filesystem::copy_symlinks">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<arg nr="1">
<returnValue type="void"/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2">
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="3" default="0" direction="out">
<not-bool/>
</arg>
</function>
<function name="boost::filesystem::copy,boost::filesystem::copy_directory,boost::filesystem::copy_file,boost::filesystem::copy_symlinks">
<!-- void copy_file(const path& from, const path& to); -->
<!-- void copy_file(const path& from, const path& to, system::error_code& ec); -->
<!-- void copy_file(const path& from, const path& to, copy_option option); -->
<!-- void copy_file(const path& from, const path& to, copy_option option, system::error_code& ec); -->
<function name="boost::filesystem::copy_file">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<arg nr="1">
<returnValue type="void"/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2">
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="3" default="0">
<not-bool/>
</arg>
<arg nr="4" default="0" direction="out">
<not-bool/>
</arg>
<arg nr="3"/>
</function>
<!-- bool create_directories(const path& p); -->
<!-- bool create_directories(const path& p, system::error_code& ec); -->
<!-- bool create_directory(const path& p); -->
<!-- bool create_directory(const path& p, system::error_code& ec); -->
<function name="boost::filesystem::create_directories,boost::filesystem::create_directory">
<noreturn>false</noreturn>
<returnValue type="bool"/>
<pure/>
<leak-ignore/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" default="0" direction="out">
<not-bool/>
</arg>
</function>
<function name="boost::filesystem::create_directories,boost::filesystem::create_directory">
<noreturn>false</noreturn>
<returnValue type="bool"/>
<pure/>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2"/>
</function>
<!-- void create_directory_symlink(const path& to, const path& new_symlink); -->
<!-- void create_directory_symlink(const path& to, const path& new_symlink, system::error_code& ec); -->
<!-- void create_hard_link(const path& to, const path& new_hard_link); -->
<!-- void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec); -->
<!-- void create_symlink(const path& to, const path& new_symlink); -->
<!-- void create_symlink(const path& to, const path& new_symlink, system::error_code& ec); -->
<!-- void rename(const path& old_p, const path& new_p); -->
<!-- void rename(const path& old_p, const path& new_p, system::error_code& ec); -->
<function name="boost::filesystem::create_directory_symlink,boost::filesystem::create_hard_link,boost::filesystem::create_symlink,boost::filesystem::rename">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<arg nr="1">
<returnValue type="void"/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2">
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<function name="boost::filesystem::create_directory_symlink,boost::filesystem::create_hard_link,boost::filesystem::create_symlink,boost::filesystem::rename">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
<arg nr="3" default="0" direction="out">
<not-bool/>
</arg>
<arg nr="2">
<not-uninit/>
</arg>
<arg nr="3"/>
</function>
<!-- endian conversion functions -->
<!-- https://www.boost.org/doc/libs/1_69_0/libs/endian/doc/conversion.html -->
<!-- int8_t endian_reverse(int8_t x) noexcept; -->
<!-- int16_t endian_reverse(int16_t x) noexcept; -->
<!-- int32_t endian_reverse(int32_t x) noexcept; -->
<!-- int64_t endian_reverse(int64_t x) noexcept; -->
<!-- uint8_t endian_reverse(uint8_t x) noexcept; -->
<!-- uint16_t endian_reverse(uint16_t x) noexcept; -->
<!-- uint32_t endian_reverse(uint32_t x) noexcept; -->
<!-- uint64_t endian_reverse(uint64_t x) noexcept; -->
<!-- template <class EndianReversible> EndianReversible big_to_native(EndianReversible x) noexcept; -->
<!-- template <class EndianReversible> EndianReversible native_to_big(EndianReversible x) noexcept; -->
<!-- template <class EndianReversible> EndianReversible little_to_native(EndianReversible x) noexcept; -->
<!-- template <class EndianReversible> EndianReversible native_to_little(EndianReversible x) noexcept; -->
<!-- template <order O1, order O2, class EndianReversible> EndianReversible conditional_reverse(EndianReversible x) noexcept; -->
<!-- template <class EndianReversible> EndianReversible conditional_reverse(EndianReversible x, order order1, order order2) noexcept; -->
<function name="boost::endian::endian_reverse,boost::endian::big_to_native,boost::endian::native_to_big,boost::endian::little_to_native,boost::endian::native_to_little,boost::endian::conditional_reverse">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2" default="0" direction="in">
<not-bool/>
</arg>
<arg nr="3" default="0" direction="in">
<not-bool/>
</arg>
</function>
<!-- template <class EndianReversible> void endian_reverse_inplace(EndianReversible& x) noexcept; -->
<!-- template <class EndianReversibleInplace> void big_to_native_inplace(EndianReversibleInplace& x) noexcept; -->
<!-- template <class EndianReversibleInplace> void native_to_big_inplace(EndianReversibleInplace& x) noexcept; -->
<!-- template <class EndianReversibleInplace> void little_to_native_inplace(EndianReversibleInplace& x) noexcept; -->
<!-- template <class EndianReversibleInplace> void native_to_little_inplace(EndianReversibleInplace& x) noexcept; -->
<!-- template <order O1, order O2, class EndianReversibleInplace> void conditional_reverse_inplace(EndianReversibleInplace& x) noexcept; -->
<!-- template <class EndianReversibleInplace> void conditional_reverse_inplace(EndianReversibleInplace& x, order order1, order order2) noexcept; -->
<function name="boost::endian::endian_reverse_inplace,boost::endian::big_to_native_inplace,boost::endian::native_to_big,boost::endian::little_to_native_inplace,boost::endian::native_to_little_inplace,boost::endian::conditional_reverse_inplace">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<arg nr="1">
<arg nr="1" direction="inout">
<not-uninit/>
<not-null/>
</arg>
</function>
<function name="boost::endian::conditional_reverse">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
<not-null/>
<arg nr="2" default="0" direction="in">
<not-bool/>
</arg>
<arg nr="2">
<not-uninit/>
<not-null/>
</arg>
<arg nr="3">
<not-uninit/>
<not-null/>
</arg>
</function>
<function name="boost::endian::conditional_reverse_inplace">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<arg nr="1">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2">
<not-uninit/>
<not-null/>
</arg>
<arg nr="3">
<not-uninit/>
<not-null/>
<arg nr="3" default="0" direction="in">
<not-bool/>
</arg>
</function>
<!-- boost::lexical_cast -->
<!-- https://www.boost.org/doc/libs/1_69_0/doc/html/boost_lexical_cast.html -->
<!-- template<typename Target, typename Source> Target lexical_cast(const Source& arg); -->
<!-- template <typename Target> Target lexical_cast(const AnyCharacterType* chars, std::size_t count); -->
<function name="boost::lexical_cast">
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<leak-ignore/>
<arg nr="1">
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2" default="0" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- boost containers that are similar to std containers -->
<container id="boostArray" startPattern="boost :: array|scoped_array &lt;" inherits="stdArray"/>
<container id="boostCircularBuffer" startPattern="boost :: circular_buffer &lt;" inherits="stdContainer"/>
<container id="boostList" startPattern="boost :: list|slist &lt;" inherits="stdList"/>
<container id="boostMap" startPattern="boost :: map|flat_map|flat_multimap|multimap|unordered_map|unordered_multimap &lt;" inherits="stdMap"/>
<container id="boostSet" startPattern="boost :: set|flat_set|flat_multiset|multiset|unordered_set &lt;" inherits="stdSet"/>
<container id="boostVectorDeque" startPattern="boost :: deque|vector|small_vector|stable_vector|static_vector &lt;" inherits="stdVectorDeque"/>
<!-- Tell cppcheck to interpret BOOST_AUTO_TEST_CASE as a function definition -->
<define name="BOOST_AUTO_TEST_CASE(str)" value="void BOOST_AUTO_TEST_CASE_run(str)"/>
<define name="BOOST_FIXTURE_TEST_CASE(str1, str2)" value="void BOOST_FIXTURE_TEST_CASE_run(str1,str2)"/>
<define name="BOOST_PYTHON_MODULE(str)" value="void BOOST_PYTHON_MODULE_definition(str)"/>
</def>

View File

@ -8,6 +8,8 @@
//
#include <boost/config.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/endian/conversion.hpp>
BOOST_FORCEINLINE void boost_forceinline_test()
@ -28,4 +30,31 @@ void valid_code()
}
if (BOOST_UNLIKELY(0)) {
}
int int1 = 5;
boost::endian::endian_reverse_inplace(int1);
}
void ignoredReturnValue(char * buf)
{
// cppcheck-suppress ignoredReturnValue
boost::math::round(1.5);
// cppcheck-suppress ignoredReturnValue
boost::math::iround(1.5);
// cppcheck-suppress ignoredReturnValue
boost::math::lround(1.5);
// cppcheck-suppress ignoredReturnValue
boost::math::llround(1.5);
// cppcheck-suppress ignoredReturnValue
boost::endian::endian_reverse(1);
}
void uninitvar()
{
int intUninit1;
int intUninit2;
// cppcheck-suppress uninitvar
boost::endian::endian_reverse_inplace(intUninit1);
// cppcheck-suppress uninitvar
(void)boost::math::round(intUninit2);
}