diff options
-rwxr-xr-x | scripts/checkpatch.pl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index fd6481649258..aa009a3b5b81 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -356,6 +356,13 @@ sub sanitise_line { | |||
356 | $off++; | 356 | $off++; |
357 | next; | 357 | next; |
358 | } | 358 | } |
359 | if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { | ||
360 | $sanitise_quote = '//'; | ||
361 | |||
362 | substr($res, $off, 2, $sanitise_quote); | ||
363 | $off++; | ||
364 | next; | ||
365 | } | ||
359 | 366 | ||
360 | # A \ in a string means ignore the next character. | 367 | # A \ in a string means ignore the next character. |
361 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && | 368 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && |
@@ -379,6 +386,8 @@ sub sanitise_line { | |||
379 | #print "c<$c> SQ<$sanitise_quote>\n"; | 386 | #print "c<$c> SQ<$sanitise_quote>\n"; |
380 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { | 387 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { |
381 | substr($res, $off, 1, $;); | 388 | substr($res, $off, 1, $;); |
389 | } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { | ||
390 | substr($res, $off, 1, $;); | ||
382 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { | 391 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { |
383 | substr($res, $off, 1, 'X'); | 392 | substr($res, $off, 1, 'X'); |
384 | } else { | 393 | } else { |
@@ -386,6 +395,10 @@ sub sanitise_line { | |||
386 | } | 395 | } |
387 | } | 396 | } |
388 | 397 | ||
398 | if ($sanitise_quote eq '//') { | ||
399 | $sanitise_quote = ''; | ||
400 | } | ||
401 | |||
389 | # The pathname on a #include may be surrounded by '<' and '>'. | 402 | # The pathname on a #include may be surrounded by '<' and '>'. |
390 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { | 403 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { |
391 | my $clean = 'X' x length($1); | 404 | my $clean = 'X' x length($1); |