[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1431006471.9365.124.camel@perches.com>
Date: Thu, 07 May 2015 06:47:51 -0700
From: Joe Perches <joe@...ches.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org
Subject: Re: [patch] checkpatch: complain about GW-BASIC style label names
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"
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists