mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Randy Dunlap <rdunlap@xenotime.net>,
	Joel Schopp <jschopp@austin.ibm.com>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andy Whitcroft <apw@shadowen.org>
Subject: [PATCH 06/13] checkpatch: pull out known acceptable typedefs
Date: Fri,  3 Oct 2008 16:25:47 +0100	[thread overview]
Message-ID: <1223047554-31111-7-git-send-email-apw@shadowen.org> (raw)
In-Reply-To: <1223047554-31111-1-git-send-email-apw@shadowen.org>

Within the type checker we have a number of common kernel types which
must be implemented as typedefs.  Pull those out so that we can use
the same expressions to trigger exclusions.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
 scripts/checkpatch.pl |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bb88df2..4680ccf 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -146,6 +146,11 @@ our $UTF8	= qr {
 	|  \xF4[\x80-\x8F][\x80-\xBF]{2}     # plane 16
 }x;
 
+our $typeTypedefs = qr{(?x:
+	(?:__)?(?:u|s|be|le)(?:\d|\d\d)|
+	atomic_t
+)};
+
 our @typeList = (
 	qr{void},
 	qr{(?:unsigned\s+)?char},
@@ -159,7 +164,6 @@ our @typeList = (
 	qr{float},
 	qr{double},
 	qr{bool},
-	qr{(?:__)?(?:u|s|be|le)(?:\d|\d\d)},
 	qr{struct\s+$Ident},
 	qr{union\s+$Ident},
 	qr{enum\s+$Ident},
@@ -179,6 +183,7 @@ sub build_types {
 			(?:$Modifier\s+|const\s+)*
 			(?:
 				(?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)|
+				(?:$typeTypedefs\b)|
 				(?:${all}\b)
 			)
 			(?:\s+$Modifier|\s+const)*
@@ -1589,6 +1594,7 @@ sub process {
 		if ($line =~ /\btypedef\s/ &&
 		    $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ &&
 		    $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
+		    $line !~ /\b$typeTypedefs\b/ &&
 		    $line !~ /\b__bitwise(?:__|)\b/) {
 			WARN("do not add new typedefs\n" . $herecurr);
 		}
-- 
1.6.0.1.451.gc8d31


  parent reply	other threads:[~2008-10-03 15:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-03 15:25 [PATCH 00/13] checkpatch: update to version 0.24 Andy Whitcroft
2008-10-03 15:25 ` [PATCH 01/13] checkpatch: do is not a possible type Andy Whitcroft
2008-10-03 15:25 ` [PATCH 02/13] checkpatch: labels are not possible types Andy Whitcroft
2008-10-03 15:25 ` [PATCH 03/13] checkpatch: handle do without braces if we have enough context Andy Whitcroft
2008-10-03 15:25 ` [PATCH 04/13] checkpatch: macros which define structure members are not complex Andy Whitcroft
2008-10-03 15:25 ` [PATCH 05/13] checkpatch: accept any sized le/be type Andy Whitcroft
2008-10-03 15:25 ` Andy Whitcroft [this message]
2008-10-03 15:25 ` [PATCH 07/13] checkpatch: suspect code indent must stop at #else/#elif Andy Whitcroft
2008-10-03 15:25 ` [PATCH 08/13] checkpatch: complex macros checks miss square brackets Andy Whitcroft
2008-10-03 15:25 ` [PATCH 09/13] checkpatch: DEFINE_ macros are real definitions for exports Andy Whitcroft
2008-10-03 15:25 ` [PATCH 10/13] checkpatch: trailing statements ensure we report the end of the line Andy Whitcroft
2008-10-03 15:25 ` [PATCH 11/13] checkpatch: suspect indent handle macro continuation Andy Whitcroft
2008-10-03 15:25 ` [PATCH 12/13] checkpatch: allow for comments either side of a brace on case Andy Whitcroft
2008-10-03 15:25 ` [PATCH 13/13] checkpatch: version: 0.24 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=1223047554-31111-7-git-send-email-apw@shadowen.org \
    --to=apw@shadowen.org \
    --cc=akpm@osdl.org \
    --cc=jschopp@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rdunlap@xenotime.net \
    /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®