From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Andy Whitcroft <apw@shadowen.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Nicolas Del Piano <ndel314@gmail.com>,
gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, mail@berndporr.me.uk
Subject: [rfc PATCH] checkpatch: allow multiple const * types
Date: Fri, 25 Apr 2014 20:29:59 -0700 [thread overview]
Message-ID: <1398482999.3071.8.camel@joe-AO725> (raw)
In-Reply-To: <20140425075020.GF26890@mwanda>
On Fri, 2014-04-25 at 10:50 +0300, Dan Carpenter wrote:
> On Fri, Apr 25, 2014 at 01:06:44AM -0300, Nicolas Del Piano wrote:
> > diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
[]
> > @@ -439,6 +439,7 @@ static void *comedi_recognize(struct comedi_driver *driv, const char *name)
> > static void comedi_report_boards(struct comedi_driver *driv)
> > {
> > unsigned int i;
> > +
> > const char *const *name_ptr;
>
> The original code was correct. This is a bug in checkpatch.pl. The
> missing line check should count any lines starting with "const" or
> "static" as declarations.
Right, thanks for the report.
I'm not around for a couple weeks.
I'll fix it properly later.
It looks like the $Type test in checkpatch
should allow multiple pointer declarations like
"const foo * const *"
instead of just
"const foo * const"
but it takes awhile to test that it doesn't stuff up
something else.
Andy? Any opinion of this?
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89f44f1..daa4767 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -433,7 +433,7 @@ sub build_types {
}x;
$Type = qr{
$NonptrType
- (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)?
+ (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)*
(?:\s+$Inline|\s+$Modifier)*
}x;
$Declare = qr{(?:$Storage\s+(?:$Inline\s+)?)?$Type};
next prev parent reply other threads:[~2014-04-26 3:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-25 4:06 [PATCH] Staging: comedi: drivers: fixed a coding style issue Nicolas Del Piano
2014-04-25 7:50 ` Dan Carpenter
2014-04-26 3:29 ` Joe Perches [this message]
2014-04-26 19:52 ` [rfc PATCH] checkpatch: allow multiple const * types Dan Carpenter
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=1398482999.3071.8.camel@joe-AO725 \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@shadowen.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@berndporr.me.uk \
--cc=ndel314@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox