Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
cfg.mk | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index 609ae86..a43cb1c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -702,6 +702,17 @@ sc_preprocessor_indentation:
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
fi
+# Use 4 spaces rather than TAB for indentation for those top-level
+# function bodies. Doesn't catch all cases, but it helps.
+sc_indentation_for_function_body:
+ @for f in $$($(VC_LIST_EXCEPT) | grep -E '\.[ch](\.in)?$$'); do \
+ grep -n -A1 '^{$$' $$f | grep '^[0-9]\{1,\}-' \
+ | grep -v '^[0-9]\{1,\}-[ ]\{4\}\S' | grep -v
'^[0-9]\{1,\}-\([#}/]\|.*:\)' \
+ | $(SED) -ne "s#\(^[0-9]\{1,\}\)-#$$f:\1:#gp" | grep . && \
+ { echo '$(ME): incorrect indentation or empty for first line in function body'
1>&2; \
+ exit 1; } \
+ done || :
+
# Enforce similar spec file indentation style, by running cppi on a
# (comment-only) C file that mirrors the same layout as the spec file.
sc_spec_indentation:
--
2.17.1