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

Extracting user's macros from .config file hilariously broken

    XMLWordPrintable

Details

    • 346e84d219448bb583dbc4ad71a2850db30e1cc8

    Description

      There's some code in qt-creator/src/plugins/clangcodemodel/clangutils.cpp createClangOptions which uses ProjectPart to get project defines:

      QStringList result;
      (...)
      result << buildDefines(pPart->projectDefines, false);
      (...)
      foreach (const QString &arg, result)
              qDebug() << "\t" << qPrintable(arg);
      

      This is what it prints for the following $PROJECT.config content:

      // ADD PREDEFINED MACROS HERE!
      

      -DREDEFINED=MACROS HERE!

      // ADD PREDEFINED MACROS HERE!
      -DCOMPILER_MSVC
      

      -DREDEFINED=MACROS HERE!
      -DER_MSVC
      (okay, I guess that's not how you add macros to the project, still funny)

      // ADD PREDEFINED MACROS HERE!
      #define COMPILER_MSVC
      

      -DREDEFINED=MACROS HERE!
      -DCOMPILER_MSVC
      (almost correct!)

      // ADD PREDEFINED MACROS HERE!
      #define    COMPILER_MSVC
      

      -DREDEFINED=MACROS HERE!
      -D= COMPILER_MSVC

      This garbage is then fed to clang, which uses it for parsing source files

      Attachments

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

        Activity

          People

            erikv Erik Verbruggen
            mpawlowski Maciej Pawlowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes