Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26228

Enum created with macros causes enum highlighting to continue to the end of a file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • Qt Creator 4.15.1, Qt Creator 5.0.0
    • C/C++/Obj-C++ Support
    • None
    • Windows 10, gcc version 10.1.0 (Rev3, Built by MSYS2 project)
    • Windows

    Description

      When enum created with macros like this:

       

      #define COMMAND_TYPE_ENUM(T) \
        T(Zero, 0x00) \
        T(One, 0x01) \
        T(Two, 0x02) \
        T(Three, 0x03)
      
      enum class CommandType {
      #define TEMPLATE(name, value) k##name = value,
        COMMAND_TYPE_ENUM(TEMPLATE)
      #undef TEMPLATE
      };
      

      All further NOT-keywords highlighted as if they are enum names.

       

      I attached screenshot that shows a problem.

      If broken highlighting meet with another(normal) enum, all further code highlighted correctly,

      You can also see this on screenshot(SomeStruct2).

      If CommandType enum will have element after the macros template, all further code highlighted correctly:

       

      enum class CommandType {
      #define TEMPLATE(name, value) k##name = value,
        COMMAND_TYPE_ENUM(TEMPLATE)
      #undef TEMPLATE
        kCount
      };

      Also, code completion seems not to be affected with this issue.

       

      Tell me if you need more information.

      BR.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            g6a10g Alexey Grushevsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes