checkpatch.pl: Add warning for new __packed additions
authorTom Rini <trini@ti.com>
Tue, 25 Feb 2014 15:27:00 +0000 (10:27 -0500)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Wed, 26 Feb 2014 20:19:29 +0000 (21:19 +0100)
While there are valid reasons to use __packed, often the answer is that
you should be doing something else here instead.

Signed-off-by: Tom Rini <trini@ti.com>
scripts/checkpatch.pl

index 88c5bc77354644cd875ba9a2108b0cc7582820c1..df0820c1a11fcf44ef5d7475cd6d7216424115f4 100755 (executable)
@@ -3331,6 +3331,11 @@ sub process {
                        WARN("PREFER_PACKED",
                             "__packed is preferred over __attribute__((packed))\n" . $herecurr);
                }
+# Check for new packed members, warn to use care
+               if ($line =~ /\b(__attribute__\s*\(\s*\(.*\bpacked|__packed)\b/) {
+                       WARN("NEW_PACKED",
+                            "Adding new packed members is to be done with care\n" . $herecurr);
+               }
 
 # Check for __attribute__ aligned, prefer __aligned
                if ($line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {