Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Wed, 3 Nov 2010 16:20:42 +0100 | From | Florian Mickler <> | Subject | Re: [PATCH] checkpatch.pl: fix CAST detection to not screw with parens handling |
| |
On Wed, 3 Nov 2010 13:04:33 +0100 Florian Mickler <florian@mickler.org> wrote:
> Casts have to be handled after the last type that is followed by an > opening parenthesis is handled.
That is the wrong fix. I realized now that with that patch we would not claim anything as a CAST anymore. Better is probably to only claim a CAST if av_pending is not set. Andy, would that work? It seems to be alright... Do you have some tests for checkpatch?
Testing it with the reported line and some other random samples it seems to be alright.
Regards, Flo
>8------------------------------------------------------------------------ commit 11ed611c647420ea27124faf269d724b4fd3ade4 Author: Florian Mickler <florian@mickler.org> Date: Wed Nov 3 15:54:26 2010 +0100
checkpatch.pl: fix CAST detection
We should only claim that something is a cast if we did not encouter a token before, that did set av_pending.
This fixes the operator * in the line below to be detected as binary (vs unary).
kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL);
Reported-by: Audun Hoem <audun.hoem@gmail.com> Signed-off-by: Florian Mickler <florian@mickler.org>
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 90b54d4..06f5c44 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -859,7 +859,7 @@ sub annotate_values { $av_preprocessor = 0; } - } elsif ($cur =~ /^(\(\s*$Type\s*)\)/) { + } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') { print "CAST($1)\n" if ($dbg_values > 1); push(@av_paren_type, $type); $type = 'C';
| ![\](/images/icornerr.gif) |