From: Joe Perches Date: Fri, 5 Mar 2010 21:43:48 +0000 (-0800) Subject: scripts/checkpatch.pl: add WARN on sizeof(&foo) X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8f53a9b80f011080555c498d2ca2dc6b1a77c42c;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.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)