Bug 406798

Summary: "Emit keyword being used with non-signal" when signal is a Q_SCRIPTABLE
Product: [Developer tools] clazy Reporter: Laurent Montel <montel>
Component: generalAssignee: Sergio Martins <smartins>
Status: RESOLVED FIXED    
Severity: normal CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Laurent Montel 2019-04-23 06:11:00 UTC
When I use clazy it reports:
"kmailtransport/src/kmailtransport/transportmanager.cpp:521:10: warning: Emit keyword being used with non-signal"

void TransportManager::emitChangesCommitted()
{
    d->myOwnChange = true; // prevent us from reading our changes again
    d->appliedChange = false; // but we have to read them at least once
    emit transportsChanged();
    emit changesCommitted();
}

but changesCommitted() is a SIGNAL
see: 
Q_SIGNALS:
...
Q_SCRIPTABLE void changesCommitted();

Regards
Comment 1 Sergio Martins 2019-04-23 20:55:23 UTC
Git commit 8df0e52bcbd68c4b822f12327675cce472ae4a11 by Sergio Martins.
Committed on 23/04/2019 at 20:41.
Pushed by smartins into branch 'master'.

Add unit-test that we can use emit keywoard on scriptable signals

And closing since previous commit actually fixes it.

A  +15   -0    tests/incorrect-emit/bug406798.cpp     [License: UNKNOWN]  *
A  +0    -0    tests/incorrect-emit/bug406798.cpp.expected
M  +3    -0    tests/incorrect-emit/config.json

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://commits.kde.org/clazy/8df0e52bcbd68c4b822f12327675cce472ae4a11
Comment 2 Sergio Martins 2019-04-23 20:55:24 UTC
Git commit f36dd1971422af2f31a6554312f60a708ed65ed2 by Sergio Martins.
Committed on 23/04/2019 at 20:38.
Pushed by smartins into branch 'master'.

Process Q_SCRIPTABLE separately

It's orthogonal to being a slot or a signal

M  +18   -9    src/AccessSpecifierManager.cpp
M  +6    -2    src/AccessSpecifierManager.h
M  +11   -2    src/checks/level1/const-signal-or-slot.cpp

https://commits.kde.org/clazy/f36dd1971422af2f31a6554312f60a708ed65ed2