Skip to content

Conversation

@olabetskyi
Copy link
Collaborator

No description provided.

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"/> -->
Copy link
Collaborator

@chrchr-github chrchr-github Jan 30, 2025

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"?

Copy link
Collaborator Author

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

Copy link
Owner

@danmar danmar left a 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..

@danmar danmar merged commit 81f0086 into danmar:main Jan 30, 2025
60 checks passed
namespace {
class TestUnusedFunction : public QObject { // #13236
TestUnusedFunction();
// cppcheck-suppress functionStatic
Copy link
Collaborator

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.

QObject::connect(this, SIGNAL(doStuff()), SLOT(doStuff()));
}

void TestUnusedFunction::doStuff() {} // Should not warn here with unusedFunction
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants