[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] maint: prohibit an operator at end of line
From: |
Pádraig Brady |
Subject: |
Re: [PATCH 3/3] maint: prohibit an operator at end of line |
Date: |
Wed, 02 May 2012 09:50:59 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 |
On 05/02/2012 09:35 AM, Jim Meyering wrote:
> Eric Blake wrote:
>> On 04/30/2012 08:25 AM, Eric Blake wrote:
>>> On 04/30/2012 07:08 AM, Jim Meyering wrote:
>>>> Here's a new syntax-check rule (patch 3/3).
>>>> 1 and 2 fix violations so that the new check passes.
>>>>
>>>> For now, this is only in coreutils (grep had only two violations),
>>>> but given the long list of violations in gnulib's lib/ directory,
>>>> it may not be generally appealing enough to be added to gnulib's maint.mk:
>>>>
>>>> $ git grep -lE '(. [-/+]|&&|\|\|)$' lib
>>>
>>> Is it worth adding some more operators, such as *, ^, &, and |?
>>>
>>> (. [-/+*^]|&&?|\|\|?)$
>>
>> Also <<, >>, ==, !=, and for that matter, all of the op= operators:
>>
>> (. [-/+*^=!<>]=?|&&?|\|\|?|<<=?|>>=?)$
>
> Good point.
> Here's a more complete patch that also makes the
> regular expression overridable.
I like this as it makes the code more consistent.
> diff --git a/src/ioblksize.h b/src/ioblksize.h
> index ffd6ff3..aaea9ff 100644
> --- a/src/ioblksize.h
> +++ b/src/ioblksize.h
> @@ -28,8 +28,8 @@
> bs=$((1024*2**$i))
> printf "%7s=" $bs
> timeout --foreground -sINT 2 \
> - dd bs=$bs if=/dev/zero of=/dev/null 2>&1 |
> - sed -n 's/.* \([0-9.]* [GM]B\/s\)/\1/p'
> + dd bs=$bs if=/dev/zero of=/dev/null 2>&1 \
> + | sed -n 's/.* \([0-9.]* [GM]B\/s\)/\1/p'
> done
Generally I dislike line continuation chars,
especially when they're not needed as is the
case with the shell construct above.
But I agree with this change as it's just in a comment,
and simplifies the syntax check.
lgtm,
Pádraig.