From 5615da4547b909f3e93e30863bdb90dff51a20ec Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 24 Sep 2019 12:16:13 +0200 Subject: [PATCH] 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 ) --- cfg/std.cfg | 10 ++++++++++ test/cfg/std.cpp | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/cfg/std.cfg b/cfg/std.cfg index 74b82b85d..bf0091e40 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -7574,6 +7574,16 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init + + + + false + + + + + + malloc calloc diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 409e6c9ef..0647ec14b 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -26,6 +26,7 @@ #include #include #include +#include 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); +}