| Summary: | Object-like and function-like macros are mixed up when whitespace is unusual | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | Vitaliy <silverunicorn2011> |
| Component: | Language Support: CPP (Clang-based) | Assignee: | kdevelop-bugs-null |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | igorkuo |
| Priority: | NOR | ||
| Version First Reported In: | 5.9.220803 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | 5.10.221200 | |
| Sentry Crash Report: | |||
| Attachments: | Reproduction examples | ||
I just recently fixed this in https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/390. Please verify that it works as you expect now. |
Created attachment 154153 [details] Reproduction examples SUMMARY If a macro is defined like this: #define SOME_MACRO (1 << 6) it is an object-like macro due to the whitespace between macro name and the opening parenthesis. But when that whitespace contains no ASCII space characters (e.g. consists of a tab as in this example), KDevelop treats it as a function-like macro. Conversely, when in a function-like macro definition the parameter list is not followed by an ASCII space, the macro is treated as object-like. See the attachment for examples. STEPS TO REPRODUCE 1. Open KDevelop 2. Open the attached file OBSERVED RESULT OBJ1 and OBJ2: * are highlighted as function-like macros * in the tooltip or the code browser, - are described as “Function macro” - in some cases, the replacement list is shown after the name as if it was a parameter list - the body may be shown as empty, or the whole line (including #define) may be shown as the body FUN1, FUN2, and FUN3: * are highlighted as object-like macros * in the tooltip or the code browser - are described as “Macro” - no parameter list is shown after macro name EXPECTED RESULT OBJ1 and OBJ2: * are highlighted as object-like macros * In the tooltip or the code browser, - described as simply “Macro” - the replacement list is shown as the body FUN1, FUN2, and FUN3: * are highlighted as function-like macros * In the tooltip or the code browser, - described as “Function macro” - the parameter list is shown after macro name - the replacement list is shown as the body SOFTWARE/OS VERSIONS KDevelop: 5.9.220803 (22.08.3) Linux/KDE Plasma: KDE Plasma Version: 5.24.4 KDE Frameworks Version: 5.93.0 Qt Version: 5.15.2 clang, libclang: 12.0.1