Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f53a9b8 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

scripts/checkpatch.pl: add WARN on sizeof(&foo)



sizeof(&foo) is frequently an error.  Warn on its use.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 84938294
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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)