History

checkpatch: allow c99 style // comments

Sanitise the lines that contain c99 comments so that the error doesn't get emitted.

Joe Perches committed 10 years ago

Commit dadf6801 parent d560a5f1 file · +6 −0Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+6−0
@@ -55,6 +55,7 @@ my $spelling_file = "$D/spelling.txt"; · 54 unmodified lines
5555 my $codespell = 0;
5656 my $codespellfile = "/usr/share/codespell/dictionary.txt";
5757 my $color = 1;
58+my $allow_c99_comments = 1;
5859
5960 sub help {
6061 my ($exitcode) = @_;
@@ -1144,6 +1145,11 @@ sub sanitise_line { · 1083 unmodified lines
11441145 $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@;
11451146 }
11461147
1148+ if ($allow_c99_comments && $res =~ m@(//.*$)@) {
1149+ my $match = $1;
1150+ $res =~ s/\Q$match\E/"$;" x length($match)/e;
1151+ }
1152+
11471153 return $res;
11481154 }
11491155