Skip to content

Commit 81f0086

Browse files
authored
Fix #13236: False positive: unusedFunction reported when SLOT() is used in qt code (#7270)
1 parent cd2e4e8 commit 81f0086

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

cfg/qt.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
<reflection>
6060
<call arg="2">invokeMethod</call>
6161
</reflection>
62-
<define name="SIGNAL(X)" value="#X"/>
63-
<define name="SLOT(X)" value="#X"/>
62+
<define name="SIGNAL(X)" value="X"/>
63+
<define name="SLOT(X)" value="X"/>
6464
<!-- T qAbs(const T &t) -->
6565
<function name="qAbs">
6666
<pure/>

test/cfg/qt.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -811,4 +811,18 @@ struct BQObject_missingOverride { // #13406
811811

812812
struct DQObject_missingOverride : BQObject_missingOverride {
813813
Q_OBJECT
814-
};
814+
};
815+
816+
namespace {
817+
class TestUnusedFunction : public QObject { // #13236
818+
TestUnusedFunction();
819+
// cppcheck-suppress functionStatic
820+
void doStuff();
821+
};
822+
823+
TestUnusedFunction::TestUnusedFunction() {
824+
QObject::connect(this, SIGNAL(doStuff()), SLOT(doStuff()));
825+
}
826+
827+
void TestUnusedFunction::doStuff() {} // Should not warn here with unusedFunction
828+
}

0 commit comments

Comments
 (0)