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

static (or contained in anonymous namespace) const variables in header file are underlined as unused but they are used everywhere the header is included

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • Qt Creator 4.10.0
    • C/C++/Obj-C++ Support
    • None
    • Qt Creator 4.10.0
      Qt 5.12.5 MSVC2017 64bit
    • Windows

    Description

      I have a setup like below. I used to include it in several places - that's why I moved it to a separate header. Now I only include it once and I use it there, I get no compiler warning about unused variables - only from QtCreator.

      I can't mark those as unused - if I accidentally include it where not needed I want to be warned.

      It is probably related to QTCREATORBUG-21297 and QTCREATORBUG-21031

      #ifndef DATABASE_SPECIFICATION_H
      #define DATABASE_SPECIFICATION_H

      namespace
      {

      enum DatabaseType

      Unknown macro: { TYPE_STRING, TYPE_INT, TYPE_BOOL, TYPE_DATETIME }

      ;

      // this is a first query for second task in CHG060482: iPart Factories - Part factories
      const struct

      Unknown macro: { const char* display_name; const char* role_name; DatabaseType type; }

      QUERY_FIELDS[] =
      {

      Unknown macro: { "field 1 display name", "field_1", TYPE_STRING }

      ,

      Unknown macro: { "field 2 display name", "field_2", TYPE_INT }

      ,

      Unknown macro: { "field 3 display name", "field_3", TYPE_DATETIME }

      ,
      };

      const size_t QUERY_FIELDS_NUMBER = sizeof QUERY_FIELDS / sizeof *QUERY_FIELDS;

      }

      #endif // DATABASE_SPECIFICATION_H
      }}

      Attachments

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

        Activity

          People

            kosjar Nikolai Kosjar
            bartekbl Bartosz Błaszkiewicz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes