# Static Analyzer

[中文]

A static analyzer is a tool that checks source code for errors and vulnerabilities without running it. It helps developers find issues early, improving code quality.

## GNU Static Analyzer

The GNU Static Analyzer is distributed with GCC (refer to GCC documentation). It can be enabled with CONFIG_COMPILER_STATIC_ANALYZER to perform code checks during application builds.

### Suppressing Warnings

GNU Static Analyzer is still under development and may give some false-positive warnings. Here is an example of how to suppress unwanted warnings using IDF:

    #include "esp_compiler.h"
    /* .... */
      ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-null-dereference")
      *((volatile int *) 0) = 0;
      ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-null-dereference")
    /* .... */

## Clang Static Analyzer

See IDF Clang-Tidy

此文档对您有帮助吗？

- 反馈已收到，谢谢！
- 如果您有其他意见，欢迎填写乐鑫文档反馈表。

- 我们重视您的反馈。
- 您可以填写乐鑫文档反馈表告诉我们如何改进该文档。