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

Clang Code Model / Clazy cannot handle Q_PROPERTY with comma

    XMLWordPrintable

Details

    • All
    • 53b4d6975d5458395c10b55e99d12886ea224c49 (qt-creator/qt-creator/4.13)

    Description

      When Q_PROPERTY is used with types like QMap<Foo, Bar>, or other template type with comma, Clang Code Model and Clazy Analyzer cannot handle the comma, and produces error:

       

      // error: too many arguments provided to function-like macro invocation
      // qobjectdefs.h:62:9: note: macro 'Q_PROPERTY' defined here
      Q_PROPERTY(QMap<int, QString> keyNames MEMBER keyNames)

       

      The code compiles and works well on official Windows/macOS Qt kits.

       

      The error may come from qobjectdefs.h delivered with QtCreator. This header patches <QtCore/qobjectdefs.h> to for Clang Code Model and Clazy. However, the overriding Q_PROPERTY macro definition does not support variadic macro:

       

      // share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h
      #define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg);
      

      Without the overriding macro definition, the code compiles and Clang/Clazy stops complaining about it.

       

       

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            tellaurea Xinbo Lin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes