mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
scripts/checkpatch.pl: add WARN on sizeof(&foo)
sizeof(&foo) is frequently an error. Warn on its use. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
8493829489
commit
8f53a9b80f
@ -2572,6 +2572,11 @@ sub process {
|
||||
WARN("plain inline is preferred over $1\n" . $herecurr);
|
||||
}
|
||||
|
||||
# check for sizeof(&)
|
||||
if ($line =~ /\bsizeof\s*\(\s*\&/) {
|
||||
WARN("sizeof(& should be avoided\n" . $herecurr);
|
||||
}
|
||||
|
||||
# check for new externs in .c files.
|
||||
if ($realfile =~ /\.c$/ && defined $stat &&
|
||||
$stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
|
||||
|
Loading…
Reference in New Issue
Block a user