From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] checkpatch: complain about GW-BASIC style label names
Date: Thu, 07 May 2015 13:17:38 -0700 [thread overview]
Message-ID: <1431029858.18597.35.camel@perches.com> (raw)
In-Reply-To: <20150507194232.GA16501@mwanda>
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);
}
next prev parent reply other threads:[~2015-05-07 20:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-07 11:21 [patch] checkpatch: complain about GW-BASIC style label names Dan Carpenter
2015-05-07 13:47 ` Joe Perches
2015-05-07 19:42 ` Dan Carpenter
2015-05-07 20:17 ` Joe Perches [this message]
2015-05-07 20:35 ` Joe Perches
2015-05-13 12:37 ` [patch v2] " Dan Carpenter
2015-05-13 13:16 ` David Sterba
2015-05-13 13:47 ` Dan Carpenter
2015-05-13 13:49 ` One Thousand Gnomes
2015-06-04 10:46 ` Dan Carpenter
2015-05-13 14:12 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431029858.18597.35.camel@perches.com \
--to=joe@perches.com \
--cc=apw@canonical.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.