From: Phil Carmody <ext-phil.2.carmody@nokia.com>
To: ext Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org, apw@canonical.com
Subject: Re: [PATCH 1/1] checkpatch: don't fake typedefs with #define
Date: Tue, 22 May 2012 11:01:23 +0300 [thread overview]
Message-ID: <20120522080123.GD25862@pcarmody2.research.nokia.com> (raw)
In-Reply-To: <1337618463.13010.4.camel@joe2Laptop>
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
next prev parent reply other threads:[~2012-05-22 8:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-17 12:52 Phil Carmody
2012-05-17 20:54 ` Joe Perches
2012-05-17 21:16 ` Phil Carmody
2012-05-17 21:24 ` Joe Perches
2012-05-21 12:05 ` Phil Carmody
2012-05-21 16:41 ` Joe Perches
2012-05-22 8:01 ` Phil Carmody [this message]
2012-05-22 16:48 ` Joe Perches
2012-05-23 1:54 ` Ryan Mallon
2012-05-23 2:02 ` Joe Perches
2012-05-23 2:50 ` Ryan Mallon
2012-05-23 3:25 ` Joe Perches
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=20120522080123.GD25862@pcarmody2.research.nokia.com \
--to=ext-phil.2.carmody@nokia.com \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome