mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@canonical.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 3/8] checkpatch: correctly handle type spacing in the face of modifiers
Date: Fri, 30 Jan 2009 15:05:15 +0000	[thread overview]
Message-ID: <1233327920-16691-4-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1233327920-16691-1-git-send-email-apw@canonical.com>

We need to handle interspersed modifiers in the middle of pointer types,
for example:

	void * __user * __user bar;

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 scripts/checkpatch.pl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5ffc940..92d1371 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1658,7 +1658,7 @@ sub process {
 
 # * goes on variable not on type
 		# (char*[ const])
-		if ($line =~ m{\($NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)*)\)}) {
+		if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) {
 			my ($from, $to) = ($1, $1);
 
 			# Should start with a space.
@@ -1673,7 +1673,7 @@ sub process {
 			if ($from ne $to) {
 				ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" .  $herecurr);
 			}
-		} elsif ($line =~ m{\b$NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)?)($Ident)}) {
+		} elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) {
 			my ($from, $to, $ident) = ($1, $1, $2);
 
 			# Should start with a space.
-- 
1.6.1.2.419.g0d87e


  parent reply	other threads:[~2009-01-30 15:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30 15:05 [PATCH 0/8] update checkpatch to v0.28 Andy Whitcroft
2009-01-30 15:05 ` [PATCH 1/8] checkpatch: make in_atomic ok in the core Andy Whitcroft
2009-01-30 15:05 ` [PATCH 2/8] checkpatch: do not warn about -p0 patches when checking files Andy Whitcroft
2009-01-30 15:05 ` Andy Whitcroft [this message]
2009-01-30 15:05 ` [PATCH 4/8] checkpatch: pointer type star may have modifiers following Andy Whitcroft
2009-01-30 15:05 ` [PATCH 5/8] checkpatch: a modifier is not an identifier at the end of a type Andy Whitcroft
2009-01-30 15:05 ` [PATCH 6/8] checkpatch: extend attribute testing to all modifiers Andy Whitcroft
2009-01-30 15:05 ` [PATCH 7/8] checkpatch: add __ref as a sparse modifier Andy Whitcroft
2009-01-30 15:05 ` [PATCH 8/8] checkpatch: version 0.28 Andy Whitcroft

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=1233327920-16691-4-git-send-email-apw@canonical.com \
    --to=apw@canonical.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®