Skip to content

Commit

Permalink
checkpatch: allow c99 style // comments
Browse files Browse the repository at this point in the history
Sanitise the lines that contain c99 comments so that the error doesn't
get emitted.

Link: http://lkml.kernel.org/r/d4d22c34ad7bcc1bceb52f0742f76b7a6d585235.1468368420.git.joe@perches.com
Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Aug 2, 2016
1 parent d560a5f commit dadf680
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
my $codespell = 0;
my $codespellfile = "/usr/share/codespell/dictionary.txt";
my $color = 1;
my $allow_c99_comments = 1;

sub help {
my ($exitcode) = @_;
Expand Down Expand Up @@ -1144,6 +1145,11 @@ sub sanitise_line {
$res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@;
}

if ($allow_c99_comments && $res =~ m@(//.*$)@) {
my $match = $1;
$res =~ s/\Q$match\E/"$;" x length($match)/e;
}

return $res;
}

Expand Down

0 comments on commit dadf680

Please sign in to comment.