Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-1900

Perf: MSVC driver should not consider unknown arguments as file names

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2
    • Fix Version/s: 4.12
    • Component/s: Compiler Driver, MSVC
    • Labels:
      None

      Description

      Reading of build-wrapper-dump.json might be slow on Windows with MSVC. Symptom of this - is empty lines in analysis log as shown below:

      INFO: Using build-wrapper output: D:\compilation-database\build-wrapper-dump.json
      INFO:
      INFO:
      INFO: 0 compilation units analyzed, current is D:\project\example.cpp
      

      And negative impact is even bigger in case of multi-module configurations that do not utilize CPP-1773 i.e. LTS <= SQ < 6.4.

      This is caused by a slow processing of command-line option /AI. The whole argument such as /AIC: is considered as filename and such name is invalid - https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

      Performance degradation in this case is a regression introduced by CPP-850.

      We should not consider arguments that start with minus and slash as filenames:

      cl /hello.c
      cl : Command line warning D9002 : ignoring unknown option '/hello.c'
      cl : Command line error D8003 : missing source filename
      

      Note that cl \hello.c works.

      Conversion of minus into slash was added in CPP-1330, but for completeness of test here:

      move hello.c -hello.c
      1 file(s) moved.
      
      cl -hello.c
      cl : Command line warning D9002 : ignoring unknown option '-hello.c'
      cl : Command line error D8003 : missing source filename
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              evgeny.mandrikov Evgeny Mandrikov
              Reporter:
              evgeny.mandrikov Evgeny Mandrikov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: