lkml.org 
[lkml]   [2015]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch v2] checkpatch: complain about GW-BASIC style label names
GW-BASIC style label names are annoying so we can warn about that in
checkpatch. The warnings look like:

WARNING: 'fail2' isn't informative - prefer descriptive label names
#267: FILE: ./sound/ppc/beep.c:267:
+ fail2: snd_ctl_remove(chip->card, beep_ctl);

This generates slightly under 2000 new warnings. None of them are
false positives.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I don't want to warn about gotos...

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89b1df4..c9e4c5b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4023,6 +4023,16 @@ sub process {
}
}

+#avoid GW-BASIC style label names
+ if ($line =~ /^.\s*((?i)(?:err|error|fail|out)[0-9]+)\s*:/) {
+ my $label = "This label";
+ if (defined $1) {
+ $label = $1;
+ }
+ WARN("BAD_LABEL_NAME",
+ "'$label' isn't informative - prefer descriptive label names\n" . $herecurr);
+ }
+
# return is not a function
if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
my $spacing = $1;

\
 
 \ /
  Last update: 2015-05-13 14:41    [W:0.071 / U:1.992 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site