Skip to contentSkip to conversation

checkpatch: Update alignment check

PATCH In review Joe Perches 2 participants 3 messages Jun 13, 2012 – Jul 26, 2012 Checkpatch

lore
Share & tools
lore

Joe Perches

author maintainer
#0 lore raw

PATCH 1/1 checkpatch: Update alignment check

Parenthesis alignment doesn't correctly check an existing line after an inserted or modified line with an open parenthesis.

Fix it.

---
 scripts/checkpatch.pl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -2
index e5bd60f..630319a 100755
@@ -1848,8 +1848,8 @@ sub process {
 
 			my $pos = pos_last_openparen($rest);
 			if ($pos >= 0) {
-				$line =~ /^\+([ \t]*)/;
-				my $newindent = $1;
+				$line =~ /^(\+| )([ \t]*)/;
+				my $newindent = $2;
 
 				my $goodtabindent = $oldindent .
 					"\t" x ($pos / 8) .
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi Andy, Joe,

Quoted 6 lines · Joe Perches

Parenthesis alignment doesn't correctly check an existing line after an inserted or modified line with an open parenthesis.

Fix it.

This fixes some bogus checkpatch warnings here. Andy, any chance this patch can make it in for 3.6-rc?

Quoted 22 lines
---
 scripts/checkpatch.pl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -3
index e5bd60f..630319a 100755
@@ -1848,8 +1848,8 @@ sub process {
 
 			my $pos = pos_last_openparen($rest);
 			if ($pos >= 0) {
-				$line =~ /^\+([ \t]*)/;
-				my $newindent = $1;
+				$line =~ /^(\+| )([ \t]*)/;
+				my $newindent = $2;
 
 				my $goodtabindent = $oldindent .
 					"\t" x ($pos / 8) .
 
 
--
Quoted 5 lines

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

- Paul

author maintainer
#2 lore raw
Quoted 3 lines · Paul Walmsley
Quoted 2 lines · Joe Perches

Parenthesis alignment doesn't correctly check an existing line after an inserted or modified line with an open parenthesis.

[]

Quoted 2 lines

This fixes some bogus checkpatch warnings here. Andy, any chance this patch can make it in for 3.6-rc?

That's pretty likely.

It's been in Andrew Morton's -mm and -next for awhile.