[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1431029858.18597.35.camel@perches.com>
Date: Thu, 07 May 2015 13:17:38 -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 22:42 +0300, Dan Carpenter wrote:
> On Thu, May 07, 2015 at 06:47:51AM -0700, Joe Perches wrote:
> > > +#avoid GW-BASIC style label names
[]
> To be honest, I'm crap at Perl.
Me too.
> Give me something to cut and paste?
[maybe below...]
> > It may be better to use a message like:
> > "Prefer functionally descriptive label naming (ie: label<why>:)\n"
> >
>
> These things are always the trickiest bit. I think of why as the goto
> location and not the label location.
>
> WARNING: Prefer a more descriptive label. What does the label do?\n
> It's also a bit crap because labels don't do anything.
Maybe something like:
# check for label names likely used in a numeric sequence of labels
if ($line =~ /^.\s*((?:err|error|fail|out)[0-9+])\s*:/i ||
$line =~ /\bgoto\s+((?:err|error|fail|out)[0-9+])\s*[:;,]/) {
my $label = "This label";
if (defined $1) {
$label = $1;
} else {
$label = $2;
}
WARN("BAD_LABEL_NAME",
"$label isn't informative - prefer descriptive gotos and labels\n" . $herecurr);
}
--
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