linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: allow reporting C99 style comments
@ 2019-01-10  5:01 Vadim Bendebury
  2019-01-10 20:24 ` Joe Perches
  2019-01-10 22:49 ` Vadim Bendebury
  0 siblings, 2 replies; 5+ messages in thread
From: Vadim Bendebury @ 2019-01-10  5:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: apw, joe, Vadim Bendebury

Presently C99 style comments are removed unconditionally before actual
patch validity check happens. This is a problem for some third party
projects which use checkpatch.pl but do not allow C99 style comments.

This patch adds yet another variable, named C99_COMMENT_TOLERANCE. If
it is included in the --ignore command line or config file options
list, C99 comments in the patch are reported as errors.

Tested by processing a patch with a C99 style comment, it passes the
check just fine unless '--ignore C99_COMMENT_TOLERANCE' is present in
.checkpatch.conf.

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b737ca9d7204..c5fe10934080 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -61,7 +61,6 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt";
 my $conststructsfile = "$D/const_structs.checkpatch";
 my $typedefsfile = "";
 my $color = "auto";
-my $allow_c99_comments = 1;
 
 sub help {
 	my ($exitcode) = @_;
@@ -1250,6 +1249,8 @@ sub sanitise_line {
 	my $off = 0;
 	my $c;
 
+	my $allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
+
 	# Always copy over the diff marker.
 	$res = substr($line, 0, 1);
 
-- 
2.20.1.97.g81188d93c3-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-11 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10  5:01 [PATCH] checkpatch: allow reporting C99 style comments Vadim Bendebury
2019-01-10 20:24 ` Joe Perches
2019-01-10 22:49 ` Vadim Bendebury
2019-01-10 23:16   ` Joe Perches
     [not found]     ` <CAC3GErFi6Hg-E81wpwDV6gpWD0pxM6Rcbj-J9Q6Rs1FOuZ3fNA@mail.gmail.com>
2019-01-11 19:11       ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).