Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d130fd0 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

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: default avatarJoe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 88f8831c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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);