lkml.org 
[lkml]   [2014]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] scripts: checkpatch.pl: Fix existing typedef false positive warning
From
Date
On Sun, 2014-09-21 at 20:32 -0500, Greg Donald wrote:
> Fixing an "open brace '{' following struct go on the same line" error causes a
> false positive warning "do not add new typedefs". Fix existing typedef false
> positive warning.

This doesn't work.
The matching deleted line can be any number of lines above.

> Signed-off-by: Greg Donald <gdonald@gmail.com>
> ---
> scripts/checkpatch.pl | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 4d08b39..eafe5e7 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3081,14 +3081,24 @@ sub process {
> }
>
> # check for new typedefs, only function parameters and sparse annotations
> -# make sense.
> +# and existing typedefs make sense.
> if ($line =~ /\btypedef\s/ &&
> $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
> $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
> $line !~ /\b$typeTypedefs\b/ &&
> $line !~ /\b__bitwise(?:__|)\b/) {
> - WARN("NEW_TYPEDEFS",
> - "do not add new typedefs\n" . $herecurr);
> + # check if $line is diff-like
> + if (substr($rawlines[$linenr - 3], 0, 1) eq '-') {
> + my $oldline3 = substr($rawlines[$linenr - 3], 1);
> + # check if typedef already existed
> + if ($line !~ /$oldline3/) {
> + WARN("NEW_TYPEDEFS",
> + "do not add new typedefs\n" . $herecurr);
> + }
> + } else {
> + WARN("NEW_TYPEDEFS",
> + "do not add new typedefs\n" . $herecurr);
> + }
> }
>
> # * goes on variable not on type





\
 
 \ /
  Last update: 2014-09-22 05:01    [W:0.039 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site