Commit dadf680d authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

checkpatch: allow c99 style // comments

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.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d560a5f8
...@@ -55,6 +55,7 @@ my $spelling_file = "$D/spelling.txt"; ...@@ -55,6 +55,7 @@ my $spelling_file = "$D/spelling.txt";
my $codespell = 0; my $codespell = 0;
my $codespellfile = "/usr/share/codespell/dictionary.txt"; my $codespellfile = "/usr/share/codespell/dictionary.txt";
my $color = 1; my $color = 1;
my $allow_c99_comments = 1;
sub help { sub help {
my ($exitcode) = @_; my ($exitcode) = @_;
...@@ -1144,6 +1145,11 @@ sub sanitise_line { ...@@ -1144,6 +1145,11 @@ sub sanitise_line {
$res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@; $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; return $res;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment