[U-Boot] [PATCH v3 1/2] checkpatch.pl: Add warning for new __packed additions

Tom Rini trini at ti.com
Tue Feb 25 16:27:00 CET 2014


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 at ti.com>
---
 scripts/checkpatch.pl |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 88c5bc7..df0820c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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/) {
-- 
1.7.9.5



More information about the U-Boot mailing list