False positive in checkpatch
Hello!
The checkpatch.pl script complains as follows:
ERROR: need consistent spacing around '*' (ctx:WxB) #57: FILE: include/linux/rcupdate.h:564:
+ ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \
Of course, the two uses of '*' are doing different things, so it should be OK for the spacing to be different.
Could you please fix this?
Thanx, Paul
Joe Perches
maintainerQuoted 8 lines · Paul E. McKenney
Hello!
The checkpatch.pl script complains as follows:
ERROR: need consistent spacing around '*' (ctx:WxB) #57: FILE:
include/linux/rcupdate.h:564:(quoted diff) +1
-0+ ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \
Quoted 7 lines
Of course, the two uses of '*' are doing different things, so it should be OK for the spacing to be different.
Could you please fix this?
Thanx, Paul
Hi Paul.
Try this patch: https://lkml.org/lkml/2013/9/2/428
Andy? Can you verify this suggested patch please?
Quoted 14 lines · Joe Perches
Quoted 13 lines · Paul E. McKenney
Hello!
The checkpatch.pl script complains as follows:
ERROR: need consistent spacing around '*' (ctx:WxB) #57: FILE:
include/linux/rcupdate.h:564:(quoted diff) +1
-0+ ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \Of course, the two uses of '*' are doing different things, so it should be OK for the spacing to be different.
Could you please fix this?
Quoted 8 lines
Quoted 2 lines
Thanx, Paul
Hi Paul.
Try this patch: https://lkml.org/lkml/2013/9/2/428
Andy? Can you verify this suggested patch please?
That does it, thank you! And it does look like this patch was directed precisely at this patch. ;-)
Thanx, Paul
Andy Whitcroft
maintainerQuoted 14 lines · Joe Perches
Quoted 13 lines · Paul E. McKenney
Hello!
The checkpatch.pl script complains as follows:
ERROR: need consistent spacing around '*' (ctx:WxB) #57: FILE:
include/linux/rcupdate.h:564:(quoted diff) +1
-0+ ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \Of course, the two uses of '*' are doing different things, so it should be OK for the spacing to be different.
Could you please fix this?
Quoted 8 lines
Quoted 2 lines
Thanx, Paul
Hi Paul.
Try this patch: https://lkml.org/lkml/2013/9/2/428
Andy? Can you verify this suggested patch please?
Ok so fundamentally this goes wrong because we detect the typeof() __force part as a type, but 'space' which is a type subsituted in is not so identifiable. This leads to us identifying the '*' as a binary one.
You patch prevents the error being emitted indeed, but as we have missidentified it anything else which applies to the correct type would be missed I think.
I will see if I can get this to identify this form better.
-apw
Andy Whitcroft
maintainerQuoted 20 lines · Paul E. McKenney
Quoted 19 lines · Joe Perches
Quoted 8 lines · Paul E. McKenney
Hello!
The checkpatch.pl script complains as follows:
ERROR: need consistent spacing around '*' (ctx:WxB) #57: FILE:
include/linux/rcupdate.h:564:(quoted diff) +1
-0+ ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \Quoted 7 lines
Of course, the two uses of '*' are doing different things, so it should be OK for the spacing to be different.
Could you please fix this?
Thanx, Paul
Hi Paul.
Quoted 9 lines
Quoted 3 lines
Try this patch: https://lkml.org/lkml/2013/9/2/428
Andy? Can you verify this suggested patch please?
That does it, thank you! And it does look like this patch was directed precisely at this patch. ;-)
Thanx, Paul
How about this one, it is a bit of a hack but does at least correctly correct the formal characterisation of the operator to unary.
Working on getting this tested a bit better before sending it out formally.
-apw
Quoted 1 line
From
5b4e22c123b3492838d12181129a8c168598dbf4Mon Sep 17 00:00:00 2001
From: Andy Whitcroft <[email protected]>
Date: Tue, 24 Sep 2013 16:10:46 +0100
Subject: [PATCH] checkpatch: handle miss identified binary operators which
bump a close parenthesis
When we hit a close parenthesis, any binary operators we have without right hand sides cannot actually be binary if the code is correctly formatted. Go back and fix up any we get wrong.
--- scripts/checkpatch.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +11 -1
@@ -1277,6 +1277,16 @@ sub annotate_values { } else { print "PAREN('$1')\n" if ($dbg_values > 1); } + # Check for any pending binary operators, if they but up against this + # bracket then they are really unary, correct them. + my $pos = length($res) - 1; + while ($pos >= 0 && substr($res, $pos, 1) eq 'N') { + if (substr($var, $pos, 1) eq 'B') { + substr($var, $pos, 1) = 'U'; + print "BINARY WACKED TO UNARY at $pos\n" if ($dbg_values > 1); + } + $pos--; + } } elsif ($cur =~ /^($Ident)\s*\(/o) { print "FUNC($1)\n" if ($dbg_values > 1);
@@ -1331,12 +1341,12 @@ sub annotate_values { } elsif ($cur =~ /^(-(?![->])|\+(?!\+)|\*|\&\&|\&)/o) { my $variant; - print "OPV($1)\n" if ($dbg_values > 1); if ($type eq 'V') { $variant = 'B'; } else { $variant = 'U'; } + print "OPV($1) -> $variant\n" if ($dbg_values > 1); substr($var, length($res), 1, $variant); $type = 'N';
Signature · 1 line
1.8.1.2
Quoted 28 lines · Andy Whitcroft
Quoted 27 lines · Paul E. McKenney
Quoted 14 lines · Joe Perches
Quoted 13 lines · Paul E. McKenney
Hello!
The checkpatch.pl script complains as follows:
ERROR: need consistent spacing around '*' (ctx:WxB) #57: FILE:
include/linux/rcupdate.h:564:(quoted diff) +1
-0+ ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \Of course, the two uses of '*' are doing different things, so it should be OK for the spacing to be different.
Could you please fix this?
Quoted 8 lines
Quoted 2 lines
Thanx, Paul
Hi Paul.
Try this patch: https://lkml.org/lkml/2013/9/2/428
Andy? Can you verify this suggested patch please?
That does it, thank you! And it does look like this patch was directed precisely at this patch. ;-)
Quoted 8 lines
Quoted 2 lines
Thanx, Paul
How about this one, it is a bit of a hack but does at least correctly correct the formal characterisation of the operator to unary.
Working on getting this tested a bit better before sending it out formally.
Works for me!
Thanx, Paul
Quoted 56 lines
-apw
Quoted 1 line
From
5b4e22c123b3492838d12181129a8c168598dbf4Mon Sep 17 00:00:00 2001From: Andy Whitcroft <[email protected]>
Date: Tue, 24 Sep 2013 16:10:46 +0100
Subject: [PATCH] checkpatch: handle miss identified binary operators which
bump a close parenthesisWhen we hit a close parenthesis, any binary operators we have without right hand sides cannot actually be binary if the code is correctly formatted. Go back and fix up any we get wrong.
Signed-off-by Andy Whitcroft <[email protected]>--- scripts/checkpatch.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)scripts/checkpatch.pl +11
-1@@ -1277,6 +1277,16 @@ sub annotate_values { } else { print "PAREN('$1')\n" if ($dbg_values > 1); } + # Check for any pending binary operators, if they but up against this + # bracket then they are really unary, correct them. + my $pos = length($res) - 1; + while ($pos >= 0 && substr($res, $pos, 1) eq 'N') { + if (substr($var, $pos, 1) eq 'B') { + substr($var, $pos, 1) = 'U'; + print "BINARY WACKED TO UNARY at $pos\n" if ($dbg_values > 1); + } + $pos--; + } } elsif ($cur =~ /^($Ident)\s*\(/o) { print "FUNC($1)\n" if ($dbg_values > 1);@@ -1331,12 +1341,12 @@ sub annotate_values { } elsif ($cur =~ /^(-(?![->])|\+(?!\+)|\*|\&\&|\&)/o) { my $variant; - print "OPV($1)\n" if ($dbg_values > 1); if ($type eq 'V') { $variant = 'B'; } else { $variant = 'U'; } + print "OPV($1) -> $variant\n" if ($dbg_values > 1); substr($var, length($res), 1, $variant); $type = 'N';Signature · 1 line
1.8.1.2