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

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Fri Apr 24 14:55:14 CEST 2026


Formatting via clang-format is controlled by .clang-format.
For each statements should be formatted with a brace at the line end:

    for_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 | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/.clang-format b/.clang-format
index 48405c54ef2..22ca6955568 100644
--- a/.clang-format
+++ b/.clang-format
@@ -748,6 +748,19 @@ ForEachMacros:
   - 'ynl_attr_for_each_nested'
   - 'ynl_attr_for_each_payload'
   - 'zorro_for_each_dev'
+  # U-Boot specific
+  - 'alist_for_each'
+  - 'alist_for_each_filter'
+  - 'for_each_bl_params_node'
+  - 'ofnode_for_each_prop'
+  - 'ofnode_for_each_subnode'
+  - 'ofnode_for_each_compatible_node'
+  - 'dev_for_each_subnode'
+  - 'dev_for_each_property'
+  - 'fdt_for_each_node_by_compatible'
+  - 'for_each_console_dev'
+  - 'mtd_for_each_device'
+  - 'for_each_tpm_device'
 
 IncludeBlocks: Preserve
 IncludeCategories:
-- 
2.53.0



More information about the U-Boot mailing list