checkpatch: allow reporting C99 style comments

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.

Link: http://lkml.kernel.org/r/20190110224957.25008-1-vbendeb@chromium.org
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Vadim Bendebury 2019-03-07 16:28:38 -08:00 committed by Linus Torvalds
parent e29a70f153
commit 98005e8c74
1 changed files with 2 additions and 1 deletions

View File

@ -61,7 +61,7 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt";
my $conststructsfile = "$D/const_structs.checkpatch"; my $conststructsfile = "$D/const_structs.checkpatch";
my $typedefsfile = ""; my $typedefsfile = "";
my $color = "auto"; my $color = "auto";
my $allow_c99_comments = 1; my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
sub help { sub help {
my ($exitcode) = @_; my ($exitcode) = @_;
@ -1021,6 +1021,7 @@ if ($git) {
} }
my $vname; my $vname;
$allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
for my $filename (@ARGV) { for my $filename (@ARGV) {
my $FILE; my $FILE;
if ($git) { if ($git) {