-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #13236: False positive: unusedFunction reported when SLOT() is used in qt code #7270
Conversation
cfg/qt.cfg
Outdated
<define name="SIGNAL(X)" value="#X"/> | ||
<define name="SLOT(X)" value="#X"/> | ||
<!-- <define name="SIGNAL(X)" value="#X"/> --> | ||
<!-- <define name="SLOT(X)" value="#X"/> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this cause checkLibraryFunction warnings? Can we define value="X"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That's a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unsure if we want to mark these somehow to indicate that they are not function calls.. the testcode will be preprocessed to QObject::connect(this , doStuff(), doStuff());
Something like:
<define name="SIGNAL(X)" value="__cppcheck__(X)"/>
<define name="SLOT(X)" value="__cppcheck__(X)"/>
But imho we can implement that later if we see real problems with your SIGNAL/SLOT macros..
class TestUnusedFunction : public QObject { // #13236 | ||
TestUnusedFunction(); | ||
// cppcheck-suppress functionStatic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can avoid this by adding (void)this
to the body.
} | ||
|
||
void TestUnusedFunction::doStuff() {} // Should not warn here with unusedFunction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add a method which triggers unusedFunction
.
No description provided.