From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: devel@driverdev.osuosl.org, Larry.Finger@lwfinger.net,
gregkh@linuxfoundation.org, gulsah.1004@gmail.com,
shack@linux.com, thomas@grouk.net, linux-kernel@vger.kernel.org
Subject: [PATCH] checkpatch: Add types for other OS typedefs
Date: Wed, 21 Jan 2015 09:23:23 -0800 [thread overview]
Message-ID: <1421861003.10574.19.camel@perches.com> (raw)
In-Reply-To: <1421859873.10574.17.camel@perches.com>
bsd and sysv use different typedefs for unsigned types.
These are in types.h but not in checkpatch, so add them
to checkpatch's ability to know types.
This can avoid false positives for code like:
void foo(void)
{
int x;
uint y;
[...];
}
where checkpatch incorrectly emits a warning for
"missing a blank line after declarations".
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 41223c9..fadb47d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -339,6 +339,11 @@ our $UTF8 = qr{
| $NON_ASCII_UTF8
}x;
+our $typeOtherOSTypedefs = qr{(?x:
+ u_(?:char|short|int|long) | # bsd
+ u(?:nchar|short|int|long) # sysv
+)};
+
our $typeTypedefs = qr{(?x:
(?:__)?(?:u|s|be|le)(?:8|16|32|64)|
atomic_t
@@ -475,6 +480,7 @@ sub build_types {
(?:$Modifier\s+|const\s+)*
(?:
(?:typeof|__typeof__)\s*\([^\)]*\)|
+ (?:$typeOtherOSTypedefs\b)|
(?:$typeTypedefs\b)|
(?:${all}\b)
)
@@ -492,6 +498,7 @@ sub build_types {
(?:
(?:typeof|__typeof__)\s*\([^\)]*\)|
(?:$typeTypedefs\b)|
+ (?:$typeOtherOSTypedefs\b)|
(?:${allWithAttr}\b)
)
(?:\s+$Modifier|\s+const)*
@@ -3152,6 +3159,7 @@ sub process {
$line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
$line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
$line !~ /\b$typeTypedefs\b/ &&
+ $line !~ /\b$typeOtherOSTypedefs\b/ &&
$line !~ /\b__bitwise(?:__|)\b/) {
WARN("NEW_TYPEDEFS",
"do not add new typedefs\n" . $herecurr);
prev parent reply other threads:[~2015-01-21 17:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 14:41 [PATCH] staging: rtl8712: fix Missing a blank line after declarations Lin Kassem
2015-01-21 17:04 ` Joe Perches
2015-01-21 17:23 ` Joe Perches [this message]
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=1421861003.10574.19.camel@perches.com \
--to=joe@perches.com \
--cc=Larry.Finger@lwfinger.net \
--cc=akpm@linux-foundation.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=gulsah.1004@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shack@linux.com \
--cc=thomas@grouk.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