lkml.org 
[lkml]   [2015]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch] checkpatch: complain about GW-BASIC style label names
From
Date
On Thu, 2015-05-07 at 14:21 +0300, Dan Carpenter wrote:
> GW-BASIC style label names are quite common. This generates a warning
> like:
>
> WARNING: bad label name
> #795: FILE: drivers/ata/pata_mpc52xx.c:795:
> + err2:

Hey Dan.

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -4023,6 +4023,16 @@ sub process {
> }
> }
>
> +#avoid GW-BASIC style label names
> + if ($line=~/^\+\s*(err|error|fail|out)[0-9]+:/) {

Labels aren't always only lower case.

This may have false positives with ?: uses like
a = foo ?
err1:err2;

> + if (WARN("LABEL_NAME",
> + "bad label name\n" . $herecurr) &&
> + $fix) {
> + $fixed[$fixlinenr] =~
> + s/^(.)\s+/$1/;
> + }
> + }

There already is a $fix option in the INDENTED_LABEL test
above this one and isn't needed or wanted here.

It may be better to use a message like:
"Prefer functionally descriptive label naming (ie: label<why>:)\n"




\
 
 \ /
  Last update: 2015-05-07 16:21    [W:0.070 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site