* [PATCH] checkpatch: Don't require kernel style __attribute__ shortcuts in uapi paths
[not found] ` <6DC2528F945B4149AB6566DFB5F22ED38AAA18B7@ORSMSX109.amr.corp.intel.com>
@ 2013-11-10 21:56 ` Joe Perches
[not found] ` <1384120524.3081.18.camel@joe-AO722>
1 sibling, 0 replies; 2+ messages in thread
From: Joe Perches @ 2013-11-10 21:56 UTC (permalink / raw)
To: Dixit, Ashutosh, Andrew Morton, Andy Whitcroft; +Cc: LKML
Avoid proscribing kernel styled shortcuts for
gcc extensions of __attribute__((foo)) in the
uapi include paths.
Fix $realfile filename when using -f/--file to not
remove first level directory as if the filename
was used in a -P1 patch. Only strip the first
level directory (typically a or b) for P1 patches.
Signed-off-by: Joe Perches <joe@perches.com>
---
(resending to cc lkml)
scripts/checkpatch.pl | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 13ec69a..61090e0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1769,11 +1769,11 @@ sub process {
# extract the filename as it passes
if ($line =~ /^diff --git.*?(\S+)$/) {
$realfile = $1;
- $realfile =~ s@^([^/]*)/@@;
+ $realfile =~ s@^([^/]*)/@@ if (!$file);
$in_commit_log = 0;
} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
$realfile = $1;
- $realfile =~ s@^([^/]*)/@@;
+ $realfile =~ s@^([^/]*)/@@ if (!$file);
$in_commit_log = 0;
$p1_prefix = $1;
@@ -3877,7 +3877,8 @@ sub process {
}
# Check for __inline__ and __inline, prefer inline
- if ($line =~ /\b(__inline__|__inline)\b/) {
+ if ($realfile !~ m@\binclude/uapi/@ &&
+ $line =~ /\b(__inline__|__inline)\b/) {
if (WARN("INLINE",
"plain inline is preferred over $1\n" . $herecurr) &&
$fix) {
@@ -3887,19 +3888,22 @@ sub process {
}
# Check for __attribute__ packed, prefer __packed
- if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
+ if ($realfile !~ m@\binclude/uapi/@ &&
+ $line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
WARN("PREFER_PACKED",
"__packed is preferred over __attribute__((packed))\n" . $herecurr);
}
# Check for __attribute__ aligned, prefer __aligned
- if ($line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {
+ if ($realfile !~ m@\binclude/uapi/@ &&
+ $line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {
WARN("PREFER_ALIGNED",
"__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
}
# Check for __attribute__ format(printf, prefer __printf
- if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) {
+ if ($realfile !~ m@\binclude/uapi/@ &&
+ $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) {
if (WARN("PREFER_PRINTF",
"__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr) &&
$fix) {
@@ -3909,7 +3913,8 @@ sub process {
}
# Check for __attribute__ format(scanf, prefer __scanf
- if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) {
+ if ($realfile !~ m@\binclude/uapi/@ &&
+ $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) {
if (WARN("PREFER_SCANF",
"__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr) &&
$fix) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] checkpatch: Don't require kernel style __attribute__ shortcuts in uapi paths
[not found] ` <1384120524.3081.18.camel@joe-AO722>
@ 2013-11-11 22:01 ` Dixit, Ashutosh
0 siblings, 0 replies; 2+ messages in thread
From: Dixit, Ashutosh @ 2013-11-11 22:01 UTC (permalink / raw)
To: Joe Perches, Andrew Morton, Andy Whitcroft
Cc: Anvin, H Peter, Dutt, Sudeep, Yokoyama, Caz, Chandramouli,
Dasaratharaman, Rao, Nikhil, Kharche, Harshavardhan R, Dong,
Eddie, Waskiewicz Jr, Peter P, linux-kernel
> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Sunday, November 10, 2013 1:55 PM
> Subject: [PATCH] checkpatch: Don't require kernel style __attribute__ shortcuts
> in uapi paths
>
> Avoid proscribing kernel styled shortcuts for
> gcc extensions of __attribute__((foo)) in the
> uapi include paths.
Thanks Joe. This works for us nicely.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-11 22:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <527D5646.9010005@intel.com>
[not found] ` <6DC2528F945B4149AB6566DFB5F22ED38AAA18B7@ORSMSX109.amr.corp.intel.com>
2013-11-10 21:56 ` [PATCH] checkpatch: Don't require kernel style __attribute__ shortcuts in uapi paths Joe Perches
[not found] ` <1384120524.3081.18.camel@joe-AO722>
2013-11-11 22:01 ` Dixit, Ashutosh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.