diff mbox

[1/2] checkpatch.pl: add --no-fail-on-warn option

Message ID 1301671255-27717-2-git-send-email-mdroth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Michael Roth April 1, 2011, 3:20 p.m. UTC
checkpatch.pl complains about some things that are not strictly against
QEMU's coding style guidelines. It's good to print these, but we
shouldn't force a fail on these as it makes it difficult to automate
checkpatch.pl runs. If we're supposed to fail on these cases, they
should be handled as errors rather than warnings.

For now, however, just add a flag that enables this behavior.

Any functionality triggered by $clean = 0 is still handled as it was
previously.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 scripts/checkpatch.pl |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 075b614..770d534 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -28,6 +28,7 @@  my $mailback = 0;
 my $summary_file = 0;
 my $root;
 my %debug;
+my $no_fail_on_warn = 0;
 my $help = 0;
 
 sub help {
@@ -55,6 +56,7 @@  Options:
                              is all off)
   --test-only=WORD           report only warnings/errors containing WORD
                              literally
+  --no-fail-on-warn          print warnings, but don't fail on them
   -h, --help, --version      display this help and exit
 
 When FILE is - read standard input.
@@ -80,6 +82,7 @@  GetOptions(
 
 	'debug=s'	=> \%debug,
 	'test-only=s'	=> \$tst_only,
+	'no-fail-on-warn' => \$no_fail_on_warn,
 	'h|help'	=> \$help,
 	'version'	=> \$help
 ) or help(1);
@@ -1104,18 +1107,23 @@  sub report_dump {
 sub ERROR {
 	if (report("ERROR: $_[0]\n")) {
 		our $clean = 0;
+		our $passable = 0;
 		our $cnt_error++;
 	}
 }
 sub WARN {
 	if (report("WARNING: $_[0]\n")) {
 		our $clean = 0;
+		if ($no_fail_on_warn == 0) {
+			our $passable = 0;
+		}
 		our $cnt_warn++;
 	}
 }
 sub CHK {
 	if ($check && report("CHECK: $_[0]\n")) {
 		our $clean = 0;
+		our $passable = 0;
 		our $cnt_chk++;
 	}
 }
@@ -1162,6 +1170,7 @@  sub process {
 	my $stashindent=0;
 
 	our $clean = 1;
+	our $passable = 1;
 	my $signoff = 0;
 	my $is_patch = 0;
 
@@ -2906,5 +2915,5 @@  sub process {
 		print "CHECKPATCH in MAINTAINERS.\n";
 	}
 
-	return $clean;
+	return $passable;
 }