[PATCH v2 1/1] .clang-format: add U-Boot specific for each macros

Simon Glass sjg at chromium.org
Wed Apr 29 16:45:56 CEST 2026


Hi Heinrich,

On Wed, 29 Apr 2026 at 08:42, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> On 4/29/26 16:21, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On 2026-04-28T14:28:48, Heinrich Schuchardt
> > <heinrich.schuchardt at canonical.com> wrote:
> >> .clang-format: add U-Boot specific for each macros
> >>
> >> Formatting via clang-format is controlled by .clang-format.
> >> For each statements should be formatted with a brace at the line end:
> >>
> >>      for_each() {
> >>      }
> >>
> >> This requires clang-format to know that the symbol is not a function
> >> but a for each macro. We use some for each macros which don't exist in
> >> Linux. Add these to file .clang-format.
> >>
> >> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> >>
> >> .clang-format | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >>   1 file changed, 51 insertions(+)
> >
> > Reviewed-by: Simon Glass <sjg at chromium.org>
> >
> >> diff --git a/.clang-format b/.clang-format
> >> @@ -748,6 +748,57 @@ ForEachMacros:
> >> +  # U-Boot specific
> >> +  - '__for_each_child_of_node'
> >
> > Should the 'git grep' recipe include drivers/ and arch/ as well?
>
> Thanks for reviewing.
>
> What I did was removing the directory restriction completely.
>
> If we really need a comment, it would have to be in the # U-Boot section.

It doesn't seem important. I was referring to the '# Taken from:' comment.

Regards,
Simon


More information about the U-Boot mailing list