]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
checkpatch-add-check-for-use-of-sizeof-without-parenthesis-v2
authorJoe Perches <joe@perches.com>
Sat, 21 Jul 2012 00:55:00 +0000 (10:55 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Jul 2012 03:53:22 +0000 (13:53 +1000)
Add check that works for sizeof *foo as well as sizeof foo

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
scripts/checkpatch.pl

index a7436227bed9754feaad29c0ab126c0ae80f27b2..72c180323c56cf69e78c13578dece50b4c8ab9c8 100755 (executable)
@@ -3266,7 +3266,7 @@ sub process {
                }
 
 # check for sizeof without parenthesis
-               if ($line =~ /\bsizeof\s+($Lval)/) {
+               if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
                        WARN("SIZEOF_PARENTHESIS",
                             "sizeof $1 should be sizeof($1)\n" . $herecurr);
                }