Skip to content

Commit 39b7e28

Browse files
JoePerchestorvalds
authored andcommitted
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.org Suggested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 2011247 commit 39b7e28

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎scripts/checkpatch.pl‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,6 +2891,11 @@ sub process {
28912891
WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
28922892
}
28932893

2894+
# Check for __attribute__ aligned, prefer __aligned
2895+
if ($line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {
2896+
WARN("__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
2897+
}
2898+
28942899
# check for sizeof(&)
28952900
if ($line =~ /\bsizeof\s*\(\s*\&/) {
28962901
WARN("sizeof(& should be avoided\n" . $herecurr);

0 commit comments

Comments
 (0)