linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] checkpatch: improve operator spacing check
@ 2015-04-07  3:36 Sam Bobroff
  2015-04-07  3:52 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Bobroff @ 2015-04-07  3:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: apw, joe

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@au1.ibm.com>
---

 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 =~ /^$;+$/) {
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] checkpatch: improve operator spacing check
  2015-04-07  3:36 [PATCH 1/1] checkpatch: improve operator spacing check Sam Bobroff
@ 2015-04-07  3:52 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2015-04-07  3:52 UTC (permalink / raw)
  To: Sam Bobroff, Andrew Morton; +Cc: linux-kernel, apw

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@au1.ibm.com>

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 =~ /^$;+$/) {




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-07  3:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07  3:36 [PATCH 1/1] checkpatch: improve operator spacing check Sam Bobroff
2015-04-07  3:52 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).