# Compiler Built-ins Detection Support Overview

CDT CMake support can detect compiler-built-in include paths and preprocessor macros.
Unfortunately, it has no knowledge about the generated build system structure, the `compile_commads.json` file generated by CMake only reports source-files. To avoid the cost of running the built-ins detector for each source-file, CDT CMake support assumes that compiler built-ins are the same for each source-file in a CMake project. Therefore, detection is run just once (on the first source file found per language) per Eclipse project.

## Invariant Built-ins Detection Support

The following table shows the compilers and their supported features detected.

Compiler | Vendor | Macros | System include paths | Local include paths | MACOS Framework include paths
--- | --- | --- | --- | --- | ---
gcc | GNU Project | tested | tested | tested | NYI [1]
clang | LLVM Project | tested | tested | tested | NYI [2]
cl | Microsoft | N/A | N/A | N/A | N/A

Support status above is either:

tested
  detection is known to work
implemented (impl)
  support is implemented, but not (yet) known to work
not yet implemented (NYI)
  support is not implemented
not available (N/A)
  the compiler does not support detection (regarding the online docs only)

### Compilers supported through separate plug-ins

## Enhanced Built-ins Detection Support

Some compilers, mainly those of the GNU Compiler Collection and derivatives, report different built-ins depending on the arguments passed to the compiler. These arguments specify a non-default language level or specify non-standard default system include directories. The table below shows an overview of the supported compilers and the recognized command-line options.

Compiler | Vendor | Language Standard options | Non-Standard System include paths options
--- | --- | --- | ---
gcc | GNU Project | `-std=`, `-ansi`: tested | `--sysroot=`, `-isysroot=`, `--no-sysroot-prefix`: tested
clang | LLVM Project | `-std=`, `-ansi`: tested | `--sysroot=`, `-isysroot=`, `--no-sysroot-prefix`: tested

Remarks:

- [1] Help wanted! To implement this, the output of `gcc -E -P -dM -Wp,-v emty.c` running on OSX is needed.
- [2] Help wanted! To implement this, the output of `clang -E -P -dM -Wp,-v emty.c` running on OSX is needed.

### Compilers supported through separate plug-ins