lkml.org 
[lkml]   [2012]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/1] checkpatch: don't fake typedefs with #define
On 21/05/12 09:41 -0700, ext Joe Perches wrote:
> On Mon, 2012-05-21 at 15:05 +0300, Phil Carmody wrote:
> > +# check for deliberate avoidance of the above anti-typedef rule
> > + if ($line =~ /#\s*define\s+$Ident\s+(enum|union|struct)\s+$Ident\b/) {

> I believe this would not catch,
>
> #define typedeflike_define_t \
> struct foo
>
> If it's deliberate, you probably want to.
>
> So maybe you want to move this and use
> the $stat tests like the extern or memset
> tests do (look around line 3200).

Thanks for the pointer. This flags everything I'm interested in:

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index faea0ec..408aee0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3319,6 +3319,13 @@ sub process {
"externs should be avoided in .c files\n" . $herecurr);
}

+# check for deliberate avoidance of the anti-typedef rule
+ if (defined $stat &&
+ $stat =~ /#\s*define\s+$Ident\s+(enum|union|struct)\s+$Ident\b/) {
+ WARN("NEW_TYPEDEFS",
+ "do not fake typedefs using #define\n" . $herecurr);
+ }
+
# checks for new __setup's
if ($rawline =~ /\b__setup\("([^"]*)"/) {
my $name = $1;
--
Phil Carmody
Tel: +372 5697 1161


\
 
 \ /
  Last update: 2012-05-22 11:01    [W:0.131 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site