summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-03-20 12:14:46 +0100
committerJim Meyering <meyering@redhat.com>2010-03-20 12:14:46 +0100
commit628a5e16ddd28110c506f34667ef993d9be7b837 (patch)
tree261b82596f67606a4284f5c95d04195188b19c3a
parent773d15a70207b5c3389f3b8272553d7e3d4a272e (diff)
downloadcoreutils-628a5e16ddd28110c506f34667ef993d9be7b837.tar.xz
maint: enforce one small aspect of formatting style: space-before-"("
* cfg.mk (sc_space_before_open_paren): New rule.
-rw-r--r--cfg.mk23
1 files changed, 23 insertions, 0 deletions
diff --git a/cfg.mk b/cfg.mk
index 71f3d85a4..8a6adc2a9 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -261,6 +261,29 @@ sc_prohibit_sleep:
msg='prefer xnanosleep over other sleep interfaces' \
$(_prohibit_regexp)
+_space_before_paren_exempt =? \\n\\$$
+_space_before_paren_exempt = \
+ (\\n\\$$|%s\(to %s|delimit-method|(date|group|character)\(s\))
+# Ensure that there is a space before each open parenthesis in C code.
+sc_space_before_open_paren:
+ @if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
+ if (cpp -fpreprocessed < /dev/null > /dev/null 2>&1); then \
+ fail=0; \
+ for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
+ cpp -fpreprocessed $$c 2>/dev/null \
+ | grep -ni '[[:alnum:]](' \
+ | grep -vE '$(_space_before_paren_exempt)' \
+ | grep . && { fail=1; echo "*** $$c"; }; \
+ done; \
+ test $$fail = 1 && \
+ { echo '$(ME): the above files lack a space-before-open-paren' \
+ 1>&2; exit 1; } || :; \
+ else \
+ echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
+ fi; \
+ else :; \
+ fi
+
include $(srcdir)/dist-check.mk
update-copyright-env = \