Skip to contentSkip to conversation

checkpatch: remove rule on non-indented labels

PATCH Applied Paolo Bonzini 3 participants 3 messages Oct 7, 2011 – Nov 1, 2011 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: remove rule on non-indented labels

There are 508 non-indented (non-default) labels, and 511 that are indented. So the rule is debatable at least. Actually, in the common case of labels at the outermost scope, there is really just one place where to put the label, so the rule is just wrong IMHO.

---
 scripts/checkpatch.pl |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
scripts/checkpatch.pl +0 -6
index 0eba357..7a71324 100755
@@ -2206,12 +2206,6 @@ sub process {
 			ERROR("space prohibited before that close parenthesis ')'\n" . $herecurr);
 		}
 
-#goto labels aren't indented, allow a single space however
-		if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
-		   !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
-			WARN("labels should not be indented\n" . $herecurr);
-		}
-
 # Return is not a function.
 		if (defined($stat) && $stat =~ /^.\s*return(\s*)(\(.*);/s) {
 			my $spacing = $1;
Signature · 1 line
1.7.6
#1 lore raw
Quoted 4 lines · Paolo Bonzini

There are 508 non-indented (non-default) labels, and 511 that are indented.  So the rule is debatable at least.  Actually, in the common case of labels at the outermost scope, there is really just one place where to put the label, so the rule is just wrong IMHO.

Agreed. This is one of the checkpatch shibboleths that I just ignore when submitting patches :-)

-- PMM

#2 lore raw
In reply to Paolo Bonzini
Quoted 6 lines · Paolo Bonzini

There are 508 non-indented (non-default) labels, and 511 that are indented. So the rule is debatable at least. Actually, in the common case of labels at the outermost scope, there is really just one place where to put the label, so the rule is just wrong IMHO.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 21 lines
---
  scripts/checkpatch.pl |    6 ------
  1 files changed, 0 insertions(+), 6 deletions(-)
scripts/checkpatch.pl +0 -6
index 0eba357..7a71324 100755
@@ -2206,12 +2206,6 @@ sub process {
  			ERROR("space prohibited before that close parenthesis ')'\n" . $herecurr);
  		}
 
-#goto labels aren't indented, allow a single space however
-		if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
-		   !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
-			WARN("labels should not be indented\n" . $herecurr);
-		}
-
  # Return is not a function.
  		if (defined($stat)&&  $stat =~ /^.\s*return(\s*)(\(.*);/s) {
  			my $spacing = $1;