lkml.org 
[lkml]   [2017]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] checkpatch: fix for stripping brackets from macros.
From
Date
On Mon, 2017-12-18 at 14:17 +0000, Jeremy Sowden wrote:
> When checking macros, checkpatch.pl strips parentheses, square brackets
> and braces. However, the search-and-replace expression was not correct,
> and instead of replacing the brackets and their contents with just the
> contents, it was replacing them with literal 1's.

Jeremy:

What is the effect on the rest of the block that
uses this substituted
$dstat? Why should this be
done?

Andy:

I believe this is intentional as it simplifies
the macro analysis and has no other effect on the
rest of the block. Correct?

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -4874,9 +4874,9 @@ sub process {
> $dstat =~ s/\s*$//s;
>
> # Flatten any parentheses and braces
> - while ($dstat =~ s/\([^\(\)]*\)/1/ ||
> - $dstat =~ s/\{[^\{\}]*\}/1/ ||
> - $dstat =~ s/.\[[^\[\]]*\]/1/)
> + while ($dstat =~ s/\(([^\(\)]*)\)/$1/ ||
> + $dstat =~ s/\{([^\{\}]*)\}/$1/ ||
> + $dstat =~ s/.\[([^\[\]]*)\]/$1/)
> {
> }


\
 
 \ /
  Last update: 2017-12-18 16:13    [W:2.962 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site