aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2008-10-16 01:02:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:37 -0400
commit8ed22cad9ce16e3d8915ae75544a133c3050d96f (patch)
treeb82dc56ffae056078d65d385adb6053f7146b2ba /scripts/checkpatch.pl
parentafbe8d283b97b2317dab900fb11d2a8878ee3c23 (diff)
checkpatch: pull out known acceptable typedefs
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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bb88df2d001b..4680ccf7760c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -146,6 +146,11 @@ our $UTF8 = qr {
146 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 146 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
147}x; 147}x;
148 148
149our $typeTypedefs = qr{(?x:
150 (?:__)?(?:u|s|be|le)(?:\d|\d\d)|
151 atomic_t
152)};
153
149our @typeList = ( 154our @typeList = (
150 qr{void}, 155 qr{void},
151 qr{(?:unsigned\s+)?char}, 156 qr{(?:unsigned\s+)?char},
@@ -159,7 +164,6 @@ our @typeList = (
159 qr{float}, 164 qr{float},
160 qr{double}, 165 qr{double},
161 qr{bool}, 166 qr{bool},
162 qr{(?:__)?(?:u|s|be|le)(?:\d|\d\d)},
163 qr{struct\s+$Ident}, 167 qr{struct\s+$Ident},
164 qr{union\s+$Ident}, 168 qr{union\s+$Ident},
165 qr{enum\s+$Ident}, 169 qr{enum\s+$Ident},
@@ -179,6 +183,7 @@ sub build_types {
179 (?:$Modifier\s+|const\s+)* 183 (?:$Modifier\s+|const\s+)*
180 (?: 184 (?:
181 (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)| 185 (?:typeof|__typeof__)\s*\(\s*\**\s*$Ident\s*\)|
186 (?:$typeTypedefs\b)|
182 (?:${all}\b) 187 (?:${all}\b)
183 ) 188 )
184 (?:\s+$Modifier|\s+const)* 189 (?:\s+$Modifier|\s+const)*
@@ -1589,6 +1594,7 @@ sub process {
1589 if ($line =~ /\btypedef\s/ && 1594 if ($line =~ /\btypedef\s/ &&
1590 $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ && 1595 $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ &&
1591 $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ && 1596 $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
1597 $line !~ /\b$typeTypedefs\b/ &&
1592 $line !~ /\b__bitwise(?:__|)\b/) { 1598 $line !~ /\b__bitwise(?:__|)\b/) {
1593 WARN("do not add new typedefs\n" . $herecurr); 1599 WARN("do not add new typedefs\n" . $herecurr);
1594 } 1600 }