# Analysis modes

The analysis can operate in *Automatic Configuration* (AutoConfig) or *Manual Configuration* (Compilation Database) modes.

AutoConfig is activated by default, while the Compilation Database can be activated by supplying a `compile_commands.json` to the SonarScanner.

The analyzer must understand the code’s intended compilation options to ensure an accurate static analysis of the CFamily code.

* In Compilation Database mode, these options are provided to the analyzer through [Compilation Database](https://clang.llvm.org/docs/JSONCompilationDatabase.html): a JSON file introduced by the LLVM project.
* In AutoConfig mode, the analyzer attempts to deduce these options automatically. A set of high-level AutoConfig properties can tune the automatic deduction process. See the "AutoConfig-specific properties" section in [customizing-the-analysis](https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/languages/c-family/customizing-the-analysis "mention").

## Choosing the right analysis mode <a href="#choosing-the-right-analysis-mode" id="choosing-the-right-analysis-mode"></a>

AutoConfig mode is recommended if:

* Your projects use compilers that don’t meet the supported compiler prerequisites of Compilation Database mode.
* Your projects use compilation environments where generating a compilation database is not feasible (see [prerequisites](https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/languages/c-family/prerequisites "mention")).
* You desire a swift analysis setup without the need to allocate human resources for the generation and maintenance of the Compilation Database.
* Your projects have a low CFamily code percentage.

Compilation Database mode is recommended if:

* You seek the highest CFamily analysis quality SonarQube Server can provide. Please note that in rare instances, AutoConfig may result in some issues being overlooked.
* You want to have finer control over the analysis configuration. For example, if you want to analyze a specific build variant or several variants (see "Analyzing code variants" in [customizing-the-analysis](https://docs.sonarsource.com/sonarqube-server/analyzing-source-code/languages/c-family/customizing-the-analysis "mention")).
* You have projects with Objective-C code: Objective-C analysis is not supported in AutoConfig mode.
* You require MISRA compliance. The [MISRA Compliance 2020](https://www.misra.org.uk/app/uploads/2021/06/MISRA-Compliance-2020.pdf) document (section 2.6.5) mandates explicit configuration of implementation-defined behavior, which AutoConfig cannot guarantee. MISRA and MISRA C are the registered trade marks of [The MISRA Consortium Limited](https://misra.org.uk/).
