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

Commit 66c80b60 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

checkpatch: Add acheck for use of sizeof without parenthesis



Kernel style uses parenthesis around sizeof.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4a273195
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3265,6 +3265,12 @@ sub process {
			     "sizeof(& should be avoided\n" . $herecurr);
		}

# check for sizeof without parenthesis
		if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
			WARN("SIZEOF_PARENTHESIS",
			     "sizeof $1 should be sizeof($1)\n" . $herecurr);
		}

# check for line continuations in quoted strings with odd counts of "
		if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) {
			WARN("LINE_CONTINUATIONS",