From: René Scharfe Date: Fri, 5 Jul 2024 19:25:43 +0000 (+0200) Subject: clang-format: include kh_foreach* macros in ForEachMacros X-Git-Tag: v2.46.0-rc1~26^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1457dff9be97955f5ef9d780cc340e4691d2818b;p=thirdparty%2Fgit.git 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 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 Signed-off-by: Junio C Hamano --- diff --git a/.clang-format b/.clang-format index c592dda681..be5b4c5bf5 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