summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-01-13 02:00:00 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 17:03:11 +0100
commit3d130fd03e06672f7700e2cb694b29f9a98227ca (patch)
tree65608fc8841362c586cdfd06b69389165753ae93 /scripts/checkpatch.pl
parentcheckpatch: check for world-writeable sysfs/debugfs files (diff)
downloadlinux-3d130fd03e06672f7700e2cb694b29f9a98227ca.tar.xz
linux-3d130fd03e06672f7700e2cb694b29f9a98227ca.zip
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>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fd9560ea976c..4c0383da1c9a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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);