checksrc: add -W to allow a file to be whitelisted
Useful when a known file just doesn't comply and there's no intention to make it do so.
This commit is contained in:
@@ -28,6 +28,7 @@ my $warnings;
|
|||||||
my $errors;
|
my $errors;
|
||||||
my $file;
|
my $file;
|
||||||
my $dir=".";
|
my $dir=".";
|
||||||
|
my $wlist;
|
||||||
|
|
||||||
sub checkwarn {
|
sub checkwarn {
|
||||||
my ($num, $col, $file, $line, $msg, $error) = @_;
|
my ($num, $col, $file, $line, $msg, $error) = @_;
|
||||||
@@ -53,21 +54,35 @@ sub checkwarn {
|
|||||||
|
|
||||||
$file = shift @ARGV;
|
$file = shift @ARGV;
|
||||||
|
|
||||||
if($file =~ /-D(.*)/) {
|
while(1) {
|
||||||
$dir = $1;
|
|
||||||
$file = shift @ARGV;
|
if($file =~ /-D(.*)/) {
|
||||||
|
$dir = $1;
|
||||||
|
$file = shift @ARGV;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
elsif($file =~ /-W(.*)/) {
|
||||||
|
$wlist = $1;
|
||||||
|
$file = shift @ARGV;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$file) {
|
if(!$file) {
|
||||||
print "checksrc.pl [option] <file1> [file2] ...\n";
|
print "checksrc.pl [option] <file1> [file2] ...\n";
|
||||||
print " Options:\n";
|
print " Options:\n";
|
||||||
print " -D[DIR] Directory to prepend file names\n";
|
print " -D[DIR] Directory to prepend file names\n";
|
||||||
|
print " -W[file] Whitelist the given file - ignore all its flaws\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
scanfile("$dir/$file");
|
|
||||||
|
|
||||||
|
if($file ne "$wlist") {
|
||||||
|
scanfile("$dir/$file");
|
||||||
|
}
|
||||||
$file = shift @ARGV;
|
$file = shift @ARGV;
|
||||||
|
|
||||||
} while($file);
|
} while($file);
|
||||||
|
|||||||
Reference in New Issue
Block a user