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

[REG 4.7.2->4.8.0] Clang code model: static analysis fails for Qt 4.8.4 projects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • Qt Creator 4.8.0
    • None
    • OS: Windows 10 x64
      Compiler: Microsoft Visual C++ Compiler 9.0 (x86) (msvc-2008)
      Qt version: 4.8.4
      Build system: qmake
    • Windows

    Description

      Using Clang Tidy & Clazy Analyzer on projects using old Qt 4.8.4 libraries worked previously in Qt Creator 4.7.2 with Clang 6.0.1.0. Now in Qt Creator 4.8.0 with Clang 7.0.0, some warnings are still generated, but Clang-Tidy and Clazy aborts with exit code 1.

      This is due to Clang 7.0.0 finding errors in the Qt 4.8.4 header files like QObject:

      In file included from D:\PROGRAMMING\C++\QT4\Qt4ClangModel\main.cpp:1:
      In file included from D:\Qt\4.8.4\include\QtCore\QObject:1:
      In file included from D:\Qt\4.8.4\include\QtCore/qobject.h:1:
      D:\Qt\4.8.4\include\QtCore/../../src/corelib/kernel/qobject.h:114:5: error: expected parameter declarator
          Q_PROPERTY(QString objectName READ objectName WRITE setObjectName)
          ^
      D:\Qt\Tools\QtCreator\share\qtcreator\cplusplus\wrappedQtHeaders\QtCore\qobjectdefs.h:62:39: note: expanded from macro 'Q_PROPERTY'
      #define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg);
                                            ^
      In file included from D:\PROGRAMMING\C++\QT4\Qt4ClangModel\main.cpp:1:
      In file included from D:\Qt\4.8.4\include\QtCore\QObject:1:
      In file included from D:\Qt\4.8.4\include\QtCore/qobject.h:1:
      D:\Qt\4.8.4\include\QtCore/../../src/corelib/kernel/qobject.h:114:5: error: expected ')'
      D:\Qt\Tools\QtCreator\share\qtcreator\cplusplus\wrappedQtHeaders\QtCore\qobjectdefs.h:62:39: note: expanded from macro 'Q_PROPERTY'
      #define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg);
                                            ^
      D:\Qt\4.8.4\include\QtCore/../../src/corelib/kernel/qobject.h:114:5: note: to match this '('
      D:\Qt\Tools\QtCreator\share\qtcreator\cplusplus\wrappedQtHeaders\QtCore\qobjectdefs.h:62:38: note: expanded from macro 'Q_PROPERTY'
      #define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg);
                                           ^
      In file included from D:\PROGRAMMING\C++\QT4\Qt4ClangModel\main.cpp:1:
      In file included from D:\Qt\4.8.4\include\QtCore\QObject:1:
      In file included from D:\Qt\4.8.4\include\QtCore/qobject.h:1:
      D:\Qt\4.8.4\include\QtCore/../../src/corelib/kernel/qobject.h:114:5: error: C++ requires a type specifier for all declarations
          Q_PROPERTY(QString objectName READ objectName WRITE setObjectName)
          ^
      D:\Qt\Tools\QtCreator\share\qtcreator\cplusplus\wrappedQtHeaders\QtCore\qobjectdefs.h:62:25: note: expanded from macro 'Q_PROPERTY'
      #define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg);
      
      

      I'm using the "Clang-Tidy and Clazy preselected checks [built-in]" Diagnostic Configuration.

      Current resolution: Without doing a clean install of Qt, I downloaded the installer of Qt Creator 4.7.2 from https://download.qt.io/official_releases/qtcreator/4.7/4.7.2/, installed it side-by-side with Qt Creator 4.8.0 and use that for static analysis of Qt 4 projects.

      It would be good to either have the option to include Qt headers with -isystem flag (if that would solve the problem) or have the option to use own version of Clang tools.

      Attached the log of the analysis.

       

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            balintkiss501 Balint Kiss
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes