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 4/7] checkpatch: fix false errors due to macro concatenation
Date: Fri, 16 Oct 2009 19:39:29 +0100	[thread overview]
Message-ID: <1255718372-22805-5-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1255718372-22805-1-git-send-email-apw@canonical.com>

The macro concatenation (##) sequence can cause false errors when checking
macro's. Checkpatch doesn't currently know about the operator.

For example this line,

+ 	entry = (struct ftrace_raw_##call *)raw_data;                   \

is correct but it produces the following error,

ERROR: need consistent spacing around '*' (ctx:WxB)
+       entry = (struct ftrace_raw_##call *)raw_data;\
                                          ^

The line above doesn't have any spacing problems, and if you remove the
macro concatenation sequence checkpatch doesn't give any errors.

Extend identifier handling to include ## concatenation within the
definition of an identifier.

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 05b10d6..cb2dac3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -130,7 +130,10 @@ if ($tree) {
 
 my $emitted_corrupt = 0;
 
-our $Ident       = qr{[A-Za-z_][A-Za-z\d_]*};
+our $Ident	= qr{
+			[A-Za-z_][A-Za-z\d_]*
+			(?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
+		}x;
 our $Storage	= qr{extern|static|asmlinkage};
 our $Sparse	= qr{
 			__user|
-- 
1.6.3.3


  parent reply	other threads:[~2009-10-16 18:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16 18:39 [PATCH 0/7] update checkpatch to v0.30 Andy Whitcroft
2009-10-16 18:39 ` [PATCH 1/7] checkpatch: possible types -- prevent illegal modifiers being added Andy Whitcroft
2009-10-16 18:39 ` [PATCH 2/7] checkpatch: correctly stop scanning at the bottom of a hunk Andy Whitcroft
2009-10-16 18:39 ` [PATCH 3/7] checkpatch: update copyright dates Andy Whitcroft
2009-10-16 18:39 ` Andy Whitcroft [this message]
2009-10-16 18:39 ` [PATCH 5/7] checkpatch: fix __attribute__ matching Andy Whitcroft
2009-10-16 18:39 ` [PATCH 6/7] checkpatch: fix false EXPORT_SYMBOL warning Andy Whitcroft
2009-10-16 18:58   ` Daniel Walker
2009-10-16 23:26     ` Andy Whitcroft
2009-10-16 18:39 ` [PATCH 7/7] checkpatch: version 0.30 Andy Whitcroft
2009-10-16 18:56 ` [PATCH 0/7] update checkpatch to v0.30 Joe Perches
2009-10-16 23:29   ` 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=1255718372-22805-5-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®