Messages in this thread Patch in this message | | | Date | Wed, 13 May 2015 15:37:12 +0300 | From | Dan Carpenter <> | 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;
| |