diff options
author | Joe Perches <joe@perches.com> | 2016-08-02 17:04:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-02 19:35:11 -0400 |
commit | dadf680de3c2eb4cba9840619991eda0cfe98778 (patch) | |
tree | 9d6469aab32bf962c5ee55940b3d5f4f8537eccc | |
parent | d560a5f8a46e98c2f83c5fe699e1d6f6393a14cf (diff) |
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.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a4476b61e93f..79273003d5e7 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -55,6 +55,7 @@ my $spelling_file = "$D/spelling.txt"; | |||
55 | my $codespell = 0; | 55 | my $codespell = 0; |
56 | my $codespellfile = "/usr/share/codespell/dictionary.txt"; | 56 | my $codespellfile = "/usr/share/codespell/dictionary.txt"; |
57 | my $color = 1; | 57 | my $color = 1; |
58 | my $allow_c99_comments = 1; | ||
58 | 59 | ||
59 | sub help { | 60 | sub help { |
60 | my ($exitcode) = @_; | 61 | my ($exitcode) = @_; |
@@ -1144,6 +1145,11 @@ sub sanitise_line { | |||
1144 | $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@; | 1145 | $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@; |
1145 | } | 1146 | } |
1146 | 1147 | ||
1148 | if ($allow_c99_comments && $res =~ m@(//.*$)@) { | ||
1149 | my $match = $1; | ||
1150 | $res =~ s/\Q$match\E/"$;" x length($match)/e; | ||
1151 | } | ||
1152 | |||
1147 | return $res; | 1153 | return $res; |
1148 | } | 1154 | } |
1149 | 1155 | ||