diff --git a/cfg.mk b/cfg.mk index 680c31260658674714bd18c214418940005651ac..8b89cd217d441cf33629ffefe5b2d6f9efcc4d1b 100644 --- a/cfg.mk +++ b/cfg.mk @@ -251,6 +251,19 @@ sc_prohibit_trailing_blank_lines: rm -f $@-t; \ test $$found = 0 +# Regex for grep -E that exempts generated files from style rules. +preprocessor_exempt = (remote_(driver|protocol)\.h)$$ +# Enforce recommended preprocessor indentation style. +sc_preprocessor_indentation: + @if (cppi --version >/dev/null 2>&1); then \ + $(VC_LIST_EXCEPT) | grep '\.[ch]$$' \ + | grep -vE '$(preprocessor_exempt)' | xargs cppi -a -c \ + || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \ + exit 1; }; \ + else \ + echo '$(ME): skipping test $@: cppi not installed' 1>&2; \ + fi + # We don't use this feature of maint.mk. prev_version_file = /dev/null