clang-format: use git grep to generate the ForEachMacros list
The ForEachMacros list can reasonably be generated grepping the C source code for macros with 'for_each' in their name. Taken almost verbatim from the .clang-format file in the Linux kernel. Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Miguel Ojeda committed
Jun 4, 2019 at 00:48 UTC
fc7e03aace379c3d6b00ac977447f115421324fe
1 file changed
+15
-2
.clang-format
+15
-2
@@ -148,8 +148,21 @@ SpacesInSquareBrackets: false
148
Cpp11BracedListStyle: false
149
150
# A list of macros that should be interpreted as foreach loops instead of as
151
-# function calls.
152
-ForEachMacros: ['for_each_string_list_item', 'for_each_wanted_builtin', 'for_each_builtin', 'for_each_ut']
151
+# 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
155
+ForEachMacros:
156
+ - 'for_each_abbrev'
157
+ - 'for_each_builtin'
158
+ - 'for_each_string_list_item'
159
+ - 'for_each_ut'
160
+ - 'for_each_wanted_builtin'
161
+ - 'list_for_each'
162
+ - 'list_for_each_dir'
163
+ - 'list_for_each_prev'
164
+ - 'list_for_each_prev_safe'
165
+ - 'list_for_each_safe'
166
167
# The maximum number of consecutive empty lines to keep.
168
MaxEmptyLinesToKeep: 1