Improve type matcher debug so we can see what it does match. As part of this move us to to using the common debug framework.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -17,7 +17,6 @@ my $quiet = 0; · 16 unmodified lines | ||
| 17 | 17 | my $tree = 1; |
| 18 | 18 | my $chk_signoff = 1; |
| 19 | 19 | my $chk_patch = 1; |
| 20 | −my $tst_type = 0; | |
| 21 | 20 | my $tst_only; |
| 22 | 21 | my $emacs = 0; |
| 23 | 22 | my $terse = 0; |
| @@ -44,7 +43,6 @@ GetOptions( · 20 unmodified lines | ||
| 44 | 43 | 'summary-file!' => \$summary_file, |
| 45 | 44 | |
| 46 | 45 | 'debug=s' => \%debug, |
| 47 | − 'test-type!' => \$tst_type, | |
| 48 | 46 | 'test-only=s' => \$tst_only, |
| 49 | 47 | ) or exit; |
| 50 | 48 | |
| @@ -67,6 +65,7 @@ if ($#ARGV < 0) { · 16 unmodified lines | ||
| 67 | 65 | |
| 68 | 66 | my $dbg_values = 0; |
| 69 | 67 | my $dbg_possible = 0; |
| 68 | +my $dbg_type = 0; | |
| 70 | 69 | for my $key (keys %debug) { |
| 71 | 70 | eval "\${dbg_$key} = '$debug{$key}';" |
| 72 | 71 | } |
| @@ -1307,8 +1306,12 @@ sub process { · 1234 unmodified lines | ||
| 1307 | 1306 | if ($line=~/^[^\+]/) {next;} |
| 1308 | 1307 | |
| 1309 | 1308 | # TEST: allow direct testing of the type matcher. |
| 1310 | − if ($tst_type && $line =~ /^.$Declare$/) { | |
| 1311 | − ERROR("TEST: is type $Declare\n" . $herecurr); | |
| 1309 | + if ($dbg_type) { | |
| 1310 | + if ($line =~ /^.\s*$Declare\s*$/) { | |
| 1311 | + ERROR("TEST: is type\n" . $herecurr); | |
| 1312 | + } elsif ($dbg_type > 1 && $line =~ /^.+($Declare)/) { | |
| 1313 | + ERROR("TEST: is not type ($1 is)\n". $herecurr); | |
| 1314 | + } | |
| 1312 | 1315 | next; |
| 1313 | 1316 | } |
| 1314 | 1317 | |