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. Acked by
upstream maintainer (see
https://marc.info/?l=linux-kernel&m=154716219806454&w=2).
BUG=none
TEST=tried processing a patch with a C99 style comment, it passes the
check just fine unless '--ignore C99_COMMENT_TOLERANCE' is
present in .checkpatch.conf.
Change-Id: I5534b8e10be0aeec1e68dcb47ec80ec3f2b3fbdb
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1407531
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
diff --git a/checkpatch.pl b/checkpatch.pl
index 2d42eb9..0e66dae 100755
--- a/checkpatch.pl
+++ b/checkpatch.pl
@@ -58,7 +58,7 @@
my $conststructsfile = "$D/const_structs.checkpatch";
my $typedefsfile = "";
my $color = "auto";
-my $allow_c99_comments = 1;
+my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
sub help {
my ($exitcode) = @_;
@@ -973,6 +973,7 @@
}
my $vname;
+$allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
for my $filename (@ARGV) {
my $FILE;
if ($git) {