From: Joe Perches Date: Fri, 5 Mar 2010 21:43:48 +0000 (-0800) Subject: scripts/checkpatch.pl: add WARN on sizeof(&foo) X-Git-Tag: v5.15~30377 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8f53a9b80f011080555c498d2ca2dc6b1a77c42c;p=mirror_ubuntu-kernels.git scripts/checkpatch.pl: add WARN on sizeof(&foo) sizeof(&foo) is frequently an error. Warn on its use. Signed-off-by: Joe Perches Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3257d3d96767..309050f30874 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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)