[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] maint: enforce one small aspect of formatting style: space-b
From: |
Jim Meyering |
Subject: |
Re: [PATCH] maint: enforce one small aspect of formatting style: space-before-"(" |
Date: |
Sat, 20 Mar 2010 18:03:13 +0100 |
Jim Meyering wrote:
> FYI, I've just pushed this to coreutils.
...
>>From 628a5e16ddd28110c506f34667ef993d9be7b837 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> Date: Sat, 20 Mar 2010 12:14:46 +0100
> Subject: [PATCH 2/2] maint: enforce one small aspect of formatting style:
> space-before-"("
...
> +_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
This is based on Pádraig Brady's idea. Sorry I didn't mention that.
I'll get it right in the log when committing for gnulib.