cppcheck/test/cfg/libsigc++.cpp
Sebastian 8fb794e731
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.
2019-10-26 17:37:14 +02:00

29 lines
694 B
C++

// 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);
}