Skip to content

Commit 5c761ce

Browse files
xyprontrini
authored andcommitted
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 f503cc4 (Add warning for new __packed additions) Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
1 parent e2888a7 commit 5c761ce

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

scripts/checkpatch.pl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5616,6 +5616,13 @@ sub process {
56165616
"__packed is preferred over __attribute__((packed))\n" . $herecurr);
56175617
}
56185618

5619+
# Check for new packed members, warn to use care
5620+
if ($realfile !~ m@\binclude/uapi/@ &&
5621+
$line =~ /\b(__attribute__\s*\(\s*\(.*\bpacked|__packed)\b/) {
5622+
WARN("NEW_PACKED",
5623+
"Adding new packed members is to be done with care\n" . $herecurr);
5624+
}
5625+
56195626
# Check for __attribute__ aligned, prefer __aligned
56205627
if ($realfile !~ m@\binclude/uapi/@ &&
56215628
$line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {

0 commit comments

Comments
 (0)