std.cfg: Add configuration and tests for std::bind() (#2207)
TODO: Somehow Cppcheck fails to print an ignoredReturnValue message when the return value is not used (see ticket https://trac.cppcheck.net/ticket/9369 )
This commit is contained in:
parent
7ee1c0aa54
commit
5615da4547
10
cfg/std.cfg
10
cfg/std.cfg
|
@ -7574,6 +7574,16 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- template< class F, class... Args > /*unspecified*/ bind( F&& f, Args&&... args ); // since C++11 -->
|
||||
<!-- template< class R, class F, class... Args > /*unspecified*/ bind( F&& f, Args&&... args ); // since C++11 -->
|
||||
<function name="std::bind">
|
||||
<noreturn>false</noreturn>
|
||||
<use-retval/>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="any"/>
|
||||
</function>
|
||||
<memory>
|
||||
<alloc init="false" buffer-size="malloc">malloc</alloc>
|
||||
<alloc init="true" buffer-size="calloc">calloc</alloc>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <cstdarg>
|
||||
#include <functional>
|
||||
|
||||
void returnValue_std_isgreater(void)
|
||||
{
|
||||
|
@ -3401,3 +3402,21 @@ void stdvector()
|
|||
// cppcheck-suppress ignoredReturnValue
|
||||
v.front();
|
||||
}
|
||||
|
||||
void stdbind_helper(int a)
|
||||
{
|
||||
printf("%d", a);
|
||||
}
|
||||
|
||||
void stdbind()
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
|
||||
// TODO cppcheck-suppress ignoredReturnValue #9369
|
||||
std::bind(stdbind_helper, 1);
|
||||
|
||||
// cppcheck-suppress unreadVariable
|
||||
auto f1 = std::bind(stdbind_helper, _1);
|
||||
// cppcheck-suppress unreadVariable
|
||||
auto f2 = std::bind(stdbind_helper, 10);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue