On Fri, Aug 29, 2025 at 12:30:25PM -0600, Javier Tia wrote: > 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:
Oh goodness, I forgot scripts/Lindent was even a thing still. We've never updated it, and it's not even been touched in the kernel since 2017 either. We should drop the tool and also update our documentation. > - 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 commit 07d9df80082b8, which > itself builds upon the initial introduction in commit d4ef8d3ff005c > ("clang-format: add configuration file"). As there's no change in .clang-format from v6.16 to the commit you mention here, I'd rather say we sync this from v6.16 and so that will make future re-syncs easier. Then comes needing to document this. We need to update doc/develop/codingstyle.rst to not talk about Lindent and then explain how to use clang-format with some examples. -- Tom
signature.asc
Description: PGP signature