checkpatch.pl: add "prefer __packed" check
There's a __packed #define for __attribute__((packed)). Add a checkpatch to tell people about it. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
88f8831c05
commit
3d130fd03e
|
@ -2743,6 +2743,11 @@ sub process {
|
|||
WARN("plain inline is preferred over $1\n" . $herecurr);
|
||||
}
|
||||
|
||||
# Check for __attribute__ packed, prefer __packed
|
||||
if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
|
||||
WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
|
||||
}
|
||||
|
||||
# check for sizeof(&)
|
||||
if ($line =~ /\bsizeof\s*\(\s*\&/) {
|
||||
WARN("sizeof(& should be avoided\n" . $herecurr);
|
||||
|
|
Loading…
Reference in New Issue