Bug 487241 - incorrect-emit confused by parentheses like emit(signal)
Summary: incorrect-emit confused by parentheses like emit(signal)
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Alexander Lohnau
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-19 15:17 UTC by gruenich (Christoph Grüninger)
Modified: 2025-01-05 09:47 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gruenich (Christoph Grüninger) 2024-05-19 15:17:50 UTC
SUMMARY
Clazy's incorrect-emit check gets confused by parentheses around the slot after emit or Q_EMIT.

STEPS TO REPRODUCE
1. emit(slot); => warning
2. emit slot; => no warning
3. Kile has always paranthesis, e.g.
    kile/src/kileproject.h:213:16: warning: Missing emit keyword on signal call KileProject::nameChanged [-Wclazy-incorrect-emit]
     213 |         Q_EMIT(nameChanged(name));
            |                ^



OBSERVED RESULT
Compiler warning
warning: Missing emit keyword on signal call KileProject::nameChanged [-Wclazy-incorrect-emit]

EXPECTED RESULT
No compiler warning

SOFTWARE/OS VERSIONS
clazy version: 1.12 (Git master)
clang version: 18.1.5
Comment 1 Alexander Lohnau 2024-12-23 10:44:26 UTC
This is reasonable, because we also have cases where we used that syntax due to clang-format bugs (introduced in v18, but fixed in v19 already)
Comment 2 gruenich (Christoph Grüninger) 2024-12-23 11:31:23 UTC
Your sentence is ambiguous. What is reasonable, the current behavior or my request to change it?
Comment 3 Alexander Lohnau 2024-12-23 18:39:32 UTC
The request is reasonable
Comment 4 Alexander Lohnau 2024-12-27 12:32:47 UTC
I have a local patch in the works, but want to check if it can be done a bit more elegantly.
Macros are a PAIN to work with the clang API, I spent quite some time on it....
Comment 5 Alexander Lohnau 2024-12-27 20:00:29 UTC
https://invent.kde.org/sdk/clazy/-/merge_requests/157
Comment 6 gruenich (Christoph Grüninger) 2025-01-04 23:05:27 UTC
Fixed in 1.13. Thanks for fixing this issue, it makes the Clazy output much more usable for working with Kile.
Comment 7 Alexander Lohnau 2025-01-05 09:47:11 UTC
Thanks :)