Skip to content

Exclude arguments from compiler queries that are not relevant to system includes or system defines #12106

Open
@Colengms

Description

@Colengms

Currently, when a compile_commands.json contains many command lines, cpptools will try to evaluate them all, in case multiple different compilers are present, different sysroots are used, or there are other args that may influence the resulting system include paths (or that we do not know will not), in order to accumulate system include paths from all of them for ingestion into the browse database.

There are various arguments (/I/-I, /D/-D, etc.) that we know will not be relevant to the compiler query. When many command lines vary by only those known irrelevant arguments, only one query is required. A problem can arise if there are arguments present that we do not know are not relevant to the query, that are different across many command lines, resulting in an excessive number of compiler queries. Often those are arguments that involve values that refer to the source file path, or some path derived from the source file path.

Opening this issue to track any arguments that could be added to our 'not relevant to a compiler query' list. Note cl is never queried, but clang-cl is, so cl arguments still need to be considered. I think clang-cl support is our biggest gap here.

(using ? as a wildcard)

  • /wd???? (CL)- used to disable compiler warnings. (Though /WX does influence the output of clang-cl)
  • /O?, /Gw? (CL) - Optimization options shouldn't influence system includes or defines.
  • -fno-math-errno (GCC) - There are probably lots of these -f arguments that are irrelevant to the compiler query, but perhaps several that are.

Related: The compiler query logic needs to be aware of which arguments involve additional following (separate) arguments, so we know to not evaluate those additional arguments as separate compiler arguments. Compiler querying issues can often be traced to new arguments added to compilers that involve additional following arguments, which need to be added to our list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions