clang-format: Add configuration file
authorJavier Tia <javier.tia@linaro.org>
Fri, 5 Sep 2025 20:53:44 +0000 (14:53 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 16 Sep 2025 19:45:00 +0000 (13:45 -0600)
commit29f6db89add2a5484ac478ba93d4574bb65ee158
tree9f61d35b9e09709ce39e952244ef715ccb2b2111
parent1116d915965604c691a9117971cbd8a731615483
clang-format: Add configuration file

Introduce .clang-format configuration file to U-Boot, providing
significant improvements over the existing scripts/Lindent approach for
C code formatting.

Benefits of clang-format over scripts/Lindent:

- More comprehensive formatting rules: While Lindent relies on the basic
  'indent' tool with limited options, clang-format provides extensive
  control over code formatting with 800+ configuration options

- Better handling of complex code structures: clang-format understands
  modern C constructs and handles nested structures, macros, and complex
  expressions more intelligently

- IDE and editor integration: Native support in major development
  environments (VS Code, Vim, Emacs, etc.) enables real-time formatting

- Consistent results across environments: Eliminates variations between
  different versions of 'indent' tool and system configurations

- Active maintenance: clang-format is actively developed and updated,
  unlike the aging 'indent' tool

Alignment with Linux kernel practices:

Continues U-Boot alignment with Linux kernel development practices,
maintaining consistency between these closely related projects. The
Linux kernel adopted clang-format to modernize its code formatting
infrastructure and improve developer experience.

The .clang-format file is based on the Linux kernel configuration,
specifically copied from Linux kernel v6.16 tag, which itself builds
upon the initial introduction in commit d4ef8d3ff005c ("clang-format:
add configuration file").

Signed-off-by: Javier Tia <javier.tia@linaro.org>
.clang-format [new file with mode: 0644]
.gitignore