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

Clang Static Analyzer does not correctly get __FUNCSIG__ defined as it is not seeing it as defined as a string

    XMLWordPrintable

Details

    Description

      Clang Static Analyzer does not correctly get _FUNCSIG_ defined as it is not seeing it as defined as a string. In the example attached, it will act as if _FUNCSIG_ is defined to _FUNCSIG_, whereas MSVC defines it to be a constant string. This causes problems with the analyzer because it will incorrectly parse the code. Giving errors such as:

      Running Clang Static Analyzer on D:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\contactlist.pro
      Analyzing "D:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\contactmodel.cpp".
      Analyzing "D:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\main.cpp".
      Failed to analyze "D:/dev/qt5.9/qtquickcontrols2/examples/quickcontrols2/contactlist/main.cpp": Clang Static Analyzer finished with exit code: 1.
      Command line: D:\Qt\qtcreator-4.4.1\bin\clang\bin\clang-cl.exe --analyze -o C:\Users\qt\AppData\Local\Temp\QtCreator-bE7tFd\qtc-clangstaticanalyzer-DbpAha\report-main.cpp-Ct7216.plist -m32 /TP /EHsc "/DUNICODE=1" "/D_UNICODE=1" "/DWIN32=1" "/DQT_NO_FOREACH=1" "/DQT_QML_DEBUG=1" "/DQT_NO_EXCEPTIONS=1" "/DQT_QUICK_LIB=1" "/DQT_GUI_LIB=1" "/DQT_QML_LIB=1" "/DQT_NETWORK_LIB=1" "/DQT_CORE_LIB=1" /U__clang__ /U__clang_major__ /U__clang_minor__ /U__clang_patchlevel__ /U__clang_version__ /ID:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist /ID:\dev\qt5.9\qtbase\include /ID:\dev\qt5.9\qtbase\include\QtQuick /ID:\dev\qt5.9\qtbase\include\QtGui /ID:\dev\qt5.9\qtbase\include\QtANGLE /ID:\dev\qt5.9\qtbase\include\QtQml /ID:\dev\qt5.9\qtbase\include\QtNetwork /ID:\dev\qt5.9\qtbase\include\QtCore /ID:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\.moc\debug /ID:\dev\qt5.9\qtbase\mkspecs\win32-msvc /ID:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\.uic "/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "/IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "/IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "/IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "/IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "/IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /IC:\PROGRA~1\IBM\IBMDAT~1\INCLUDE /IC:\PROGRA~1\IBM\IBMDAT~1\LIB "-fms-compatibility-version=19.00" D:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\main.cpp
      Process Error: 5
      Output:
      D:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\main.cpp(65,1):  error: expected ')'
      TRACE("hallo");
      ^
      D:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\main.cpp(56,43):  note: expanded from macro 'TRACE'
      #define TRACE(message) printf(__FUNCSIG__ ":" message "\r\n")
                                                ^
      D:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\main.cpp(65,1):  note: to match this '('
      D:\dev\qt5.9\qtquickcontrols2\examples\quickcontrols2\contactlist\main.cpp(56,30):  note: expanded from macro 'TRACE'
      #define TRACE(message) printf(__FUNCSIG__ ":" message "\r\n")
      

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-19295
        # Subject Branch Project Status CR V

        Activity

          People

            yvvan Ivan Donchevskii
            andysh Andy Shaw
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes