]> Git Repo - linux.git/commitdiff
checkpatch: exclude sizeof sub-expressions from MACRO_ARG_REUSE
authorBrendan Jackman <[email protected]>
Wed, 25 Sep 2019 23:46:41 +0000 (16:46 -0700)
committerLinus Torvalds <[email protected]>
Thu, 26 Sep 2019 00:51:39 +0000 (17:51 -0700)
The arguments of sizeof are not evaluated so arguments are safe to re-use
in that context.  Excluding sizeof subexpressions means macros like
ARRAY_SIZE can pass checkpatch.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Brendan Jackman <[email protected]>
Acked-by: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
scripts/checkpatch.pl

index 0b1388078b69a7424626bc01c221cc0bd138be36..d7466879d50526ad29a3a4c84b38b95bda32e727 100755 (executable)
@@ -5204,7 +5204,7 @@ sub process {
                                next if ($arg =~ /\.\.\./);
                                next if ($arg =~ /^type$/i);
                                my $tmp_stmt = $define_stmt;
-                               $tmp_stmt =~ s/\b(typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g;
+                               $tmp_stmt =~ s/\b(sizeof|typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g;
                                $tmp_stmt =~ s/\#+\s*$arg\b//g;
                                $tmp_stmt =~ s/\b$arg\s*\#\#//g;
                                my $use_cnt = () = $tmp_stmt =~ /\b$arg\b/g;
This page took 0.059822 seconds and 4 git commands to generate.