https://bugs.kde.org/show_bug.cgi?id=462415

            Bug ID: 462415
           Summary: Object-like and function-like macros are mixed up when
                    whitespace is unusual
    Classification: Applications
           Product: kdevelop
           Version: 5.9.220803
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: Language Support: CPP (Clang-based)
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: silverunicorn2...@yandex.ru
  Target Milestone: ---

Created attachment 154153
  --> https://bugs.kde.org/attachment.cgi?id=154153&action=edit
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

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to