Re: [PATCH 1/1] checkpatch: improve operator spacing check

From: Joe Perches
Date: Mon Apr 06 2015 - 23:52:58 EST


On Tue, 2015-04-07 at 13:36 +1000, Sam Bobroff wrote:
> Code such as:
> x = timercmp(&now, &end, <);
> Will currently trigger a checkpatch error. e.g.
> ERROR: spaces required around that '<'
>
> This is because the "Ignore operators passed as parameters" check
> looks only for a comma following the operator. Improve the check by
> also looking for a close parenthesis.
>
> Signed-off-by: Sam Bobroff <sam.bobroff@xxxxxxxxxxx>

Seems sensible, thanks.

> ---
>
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index d124359..f65c4de 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3565,7 +3565,7 @@ sub process {
>
> # Ignore operators passed as parameters.
> if ($op_type ne 'V' &&
> - $ca =~ /\s$/ && $cc =~ /^\s*,/) {
> + $ca =~ /\s$/ && $cc =~ /^\s*[,\)]/) {
>
> # # Ignore comments
> # } elsif ($op =~ /^$;+$/) {



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/