UPSTREAM: checkpatch.pl: Add warning for new __packed additions

While there are valid reasons to use __packed, often the answer is that
you should be doing something else here instead.

This reintroduces the changes of
f503cc49a5 (Add warning for new __packed additions)

Change-Id: I83bacea893370139a6e980a946d93db25a73baf5
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 5c761ce58666b3a1695697498598f8bf3484a0c7)
This commit is contained in:
Heinrich Schuchardt 2017-09-13 04:59:05 +02:00 committed by Kever Yang
parent ec5e502c14
commit dd10e6c7ae
1 changed files with 7 additions and 0 deletions

View File

@ -5616,6 +5616,13 @@ sub process {
"__packed is preferred over __attribute__((packed))\n" . $herecurr);
}
# Check for new packed members, warn to use care
if ($realfile !~ m@\binclude/uapi/@ &&
$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 ($realfile !~ m@\binclude/uapi/@ &&
$line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {