Commit 39b7e287 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

checkpatch: add a "prefer __aligned" check

Prefer the use of __aligned(size) over __attribute__((__aligned___(size)))

Link: http://lkml.kernel.org/r/20110609094526.1571774c.akpm@linux-foundation.orgSuggested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 20112475
...@@ -2891,6 +2891,11 @@ sub process { ...@@ -2891,6 +2891,11 @@ sub process {
WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr); WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
} }
# Check for __attribute__ aligned, prefer __aligned
if ($line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {
WARN("__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
}
# check for sizeof(&) # check for sizeof(&)
if ($line =~ /\bsizeof\s*\(\s*\&/) { if ($line =~ /\bsizeof\s*\(\s*\&/) {
WARN("sizeof(& should be avoided\n" . $herecurr); WARN("sizeof(& should be avoided\n" . $herecurr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment