Skip to content

Commit

Permalink
checkpatch: add a "prefer __aligned" check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joe Perches authored and Linus Torvalds committed Jul 26, 2011
1 parent 2011247 commit 39b7e28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2891,6 +2891,11 @@ sub process {
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(&)
if ($line =~ /\bsizeof\s*\(\s*\&/) {
WARN("sizeof(& should be avoided\n" . $herecurr);
Expand Down

0 comments on commit 39b7e28

Please sign in to comment.