File: libsigc%2B%2B.cpp

package info (click to toggle)
cppcheck 2.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 26,412 kB
  • sloc: cpp: 272,462; python: 22,408; ansic: 8,088; sh: 1,059; makefile: 1,041; xml: 987; cs: 291
file content (31 lines) | stat: -rw-r--r-- 825 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

// Test library configuration for libsigc++.cfg
//
// Usage:
// $ cppcheck --check-library --library=libsigc++ --enable=style,information --inconclusive --error-exitcode=1 --inline-suppr test/cfg/libsigc++.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//

#include <sigc++/sigc++.h> // IWYU pragma: keep
#include <sigc++/functors/mem_fun.h>
#include <sigc++/functors/slot.h>
#include <sigc++/trackable.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);
}