[patch v2] checkpatch: complain about GW-BASIC style label names

From: Dan Carpenter
Date: Wed May 13 2015 - 08:37:29 EST


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@xxxxxxxxxx>
---
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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/