Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1441925 > unrolled thread

[PATCH 2/2] checkpatch: Allow c99 style // comments

Started byJoe Perches <joe@perches.com>
First post2016-07-13 02:20 +0200
Last post2016-07-13 02:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] checkpatch: Allow c99 style // comments Joe Perches <joe@perches.com> - 2016-07-13 02:20 +0200

#1441925 — [PATCH 2/2] checkpatch: Allow c99 style // comments

FromJoe Perches <joe@perches.com>
Date2016-07-13 02:20 +0200
Subject[PATCH 2/2] checkpatch: Allow c99 style // comments
Message-ID<rUg4a-3O9-5@gated-at.bofh.it>
Sanitise the lines that contain c99 comments so that
the error doesn't get emitted.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cc787e6..a0e5112 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -55,6 +55,7 @@ my $spelling_file = "$D/spelling.txt";
 my $codespell = 0;
 my $codespellfile = "/usr/share/codespell/dictionary.txt";
 my $color = 1;
+my $allow_c99_comments = 1;
 
 sub help {
 	my ($exitcode) = @_;
@@ -1145,6 +1146,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;
 }
 
-- 
2.8.0.rc4.16.g56331f8

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web