git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clang-format: include kh_foreach* macros in ForEachMacros
@ 2024-07-05 19:25 René Scharfe
  0 siblings, 0 replies; only message in thread
From: René Scharfe @ 2024-07-05 19:25 UTC (permalink / raw)
  To: Git List

The command for generating the list of ForEachMacros searches for
macros whose name contains the string "for_each".  Include those whose
name contains "foreach" as well.  That brings in kh_foreach and
kh_foreach_value from khash.h.

Regenerating the list also brings in hashmap-based macros added by
87571c3f71 (hashmap: use *_entry APIs for iteration, 2019-10-06),
f0e63c4113 (hashmap: use *_entry APIs to wrap container_of, 2019-10-06),
4fa1d501f7 (strmap: add functions facilitating use as a string->int map,
2020-11-05), b70c82e6ed (strmap: add more utility functions,
2020-11-05), and 1201eb628a (strmap: add a strset sub-type, 2020-11-06).

for_each_abbrev is no longer found because its definition was removed by
d850b7a545 (cocci: apply the "cache.h" part of "the_repository.pending",
2023-03-28).  Note that it had been a false positive, though, as it had
been a function wrapper, not a for-like macro.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 .clang-format | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/.clang-format b/.clang-format
index 3ed4fac753..6408251577 100644
--- a/.clang-format
+++ b/.clang-format
@@ -149,20 +149,25 @@ Cpp11BracedListStyle: false

 # A list of macros that should be interpreted as foreach loops instead of as
 # function calls. Taken from:
-#   git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' \
-#   | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$,  - '\1'," \
-#   | sort | uniq
+#   git grep -h '^#define [^[:space:]]*for_\?each[^[:space:]]*(' |
+#   sed "s/^#define /  - '/; s/(.*$/'/" | sort | uniq
 ForEachMacros:
-  - 'for_each_abbrev'
   - 'for_each_builtin'
   - 'for_each_string_list_item'
   - 'for_each_ut'
   - 'for_each_wanted_builtin'
+  - 'hashmap_for_each_entry'
+  - 'hashmap_for_each_entry_from'
+  - 'kh_foreach'
+  - 'kh_foreach_value'
   - 'list_for_each'
   - 'list_for_each_dir'
   - 'list_for_each_prev'
   - 'list_for_each_prev_safe'
   - 'list_for_each_safe'
+  - 'strintmap_for_each_entry'
+  - 'strmap_for_each_entry'
+  - 'strset_for_each_entry'

 # The maximum number of consecutive empty lines to keep.
 MaxEmptyLinesToKeep: 1
--
2.45.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-05 19:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-05 19:25 [PATCH] clang-format: include kh_foreach* macros in ForEachMacros René Scharfe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).