Skip to content

Commit 1457dff

Browse files
rscharfegitster
authored andcommitted
clang-format: include kh_foreach* macros in ForEachMacros
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 87571c3 (hashmap: use *_entry APIs for iteration, 2019-10-06), f0e63c4 (hashmap: use *_entry APIs to wrap container_of, 2019-10-06), 4fa1d50 (strmap: add functions facilitating use as a string->int map, 2020-11-05), b70c82e (strmap: add more utility functions, 2020-11-05), and 1201eb6 (strmap: add a strset sub-type, 2020-11-06). for_each_abbrev is no longer found because its definition was removed by d850b7a (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0dc9cad commit 1457dff

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.clang-format

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,25 @@ Cpp11BracedListStyle: false
149149

150150
# A list of macros that should be interpreted as foreach loops instead of as
151151
# function calls. Taken from:
152-
# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' \
153-
# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
154-
# | sort | uniq
152+
# git grep -h '^#define [^[:space:]]*for_\?each[^[:space:]]*(' |
153+
# sed "s/^#define / - '/; s/(.*$/'/" | sort | uniq
155154
ForEachMacros:
156-
- 'for_each_abbrev'
157155
- 'for_each_builtin'
158156
- 'for_each_string_list_item'
159157
- 'for_each_ut'
160158
- 'for_each_wanted_builtin'
159+
- 'hashmap_for_each_entry'
160+
- 'hashmap_for_each_entry_from'
161+
- 'kh_foreach'
162+
- 'kh_foreach_value'
161163
- 'list_for_each'
162164
- 'list_for_each_dir'
163165
- 'list_for_each_prev'
164166
- 'list_for_each_prev_safe'
165167
- 'list_for_each_safe'
168+
- 'strintmap_for_each_entry'
169+
- 'strmap_for_each_entry'
170+
- 'strset_for_each_entry'
166171

167172
# The maximum number of consecutive empty lines to keep.
168173
MaxEmptyLinesToKeep: 1

0 commit comments

Comments
 (0)