Skip to content

Commit

Permalink
checkpatch: allow parentheses on return handle array values
Browse files Browse the repository at this point in the history
When we allow return to have surrounding parentheses when containing
comparison operators we are not correctly handling the case where the
values contain array sufffixes.  Squash them.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andy Whitcroft authored and Linus Torvalds committed Jan 16, 2009
1 parent f9a0b3d commit 63f17f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,11 @@ sub process {

# Flatten any parentheses
$value =~ s/\)\(/\) \(/g;
while ($value !~ /(?:$Ident|-?$Constant)\s*$Compare\s*(?:$Ident|-?$Constant)/ && $value =~ s/\([^\(\)]*\)/1/) {
while ($value =~ s/\[[^\{\}]*\]/1/ ||
$value !~ /(?:$Ident|-?$Constant)\s*
$Compare\s*
(?:$Ident|-?$Constant)/x &&
$value =~ s/\([^\(\)]*\)/1/) {
}

if ($value =~ /^(?:$Ident|-?$Constant)$/) {
Expand Down

0 comments on commit 63f17f8

Please sign in to comment.