[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] scripts/checkpatch.pl: Don't allow special case
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] scripts/checkpatch.pl: Don't allow special cases of unspaced operators |
Date: |
Fri, 18 Dec 2015 08:31:18 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 12/18/2015 05:59 AM, Peter Maydell wrote:
> The checkpatch.pl script has a special case to permit the following
> operators to have no spaces around them:
> << >> & ^ | + - * / %
>
> QEMU style prefers all operators to consistently have spacing around
> them, so remove this special case handling. This avoids reviewers
> having to manually note it during code review.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> I actually thought failing to point out the lack of spaces was
> a checkpatch parsing bug until I looked in the source and found it
> was deliberate...
>
> I say "QEMU style prefers", but possibly what I actually mean is
> "I prefer" ? Does anybody want to defend the unspaced versions?
I'm in favor of this patch; it only affects new code, and explains why I
have been spotting unspaced operators in new code that didn't trigger
checkpatch noise.
>
> scripts/checkpatch.pl | 13 -------------
> 1 file changed, 13 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index b0f6e11..efca817 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1890,19 +1890,6 @@ sub process {
> ERROR("space prohibited after
> that '$op' $at\n" . $hereptr);
> }
>
> -
> - # << and >> may either have or not have spaces
> both sides
> - } elsif ($op eq '<<' or $op eq '>>' or
> - $op eq '&' or $op eq '^' or $op eq '|'
> or
> - $op eq '+' or $op eq '-' or
> - $op eq '*' or $op eq '/' or
> - $op eq '%')
> - {
What's weird is that the comment wasn't even correct. Probably one
person special-cased << and >>, and another then extended to
special-case all operators.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature