Re: bitpos expansion patches summary

Jan Kratochvil
2012-09-13T18:45:47Z

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

On Tue, 11 Sep 2012 21:04:21 +0200, Jan Kratochvil wrote:
> Also I have found several missed expansions only by hand, one needs to do full
> re-run of splint on the patched sources. As the patched sources change line
> numbers a bit it already means some sort of rebase.

Attaching some script for remapping the old->new line numbers in a .report
file, I use it locally to play with it without any real results yet.

Jan

[-- Attachment #2: diffmap --]
[-- Type: text/plain, Size: 1146 bytes --]

#! /usr/bin/perl
use strict;
use warnings;

die "$0 'git diff -U999999 old..new|' <old.report >new.report\n" if @ARGV!=1;
my %h;
{
local *DIFF;
open DIFF,$ARGV[0] or die $ARGV[0];
my($from,$fromline,$to,$toline);
local $_;
while (<DIFF>) {
chomp;
next if /^diff /;
next if /^index /;
next if /^new file mode /;
next if /^deleted file mode /;
if (m{^--- a/(\S+)$}) {
$from=$1;
$fromline=0;
next;
}
if (m{^\Q+++\E b/(\S+)$}) {
$to=$1;
$toline=0;
next;
}
next if /^@@ -[10](?:,\d+)? [+][10](?:,\d+)? @@(?:)$/;
if (/^ /) {
$fromline++;
$toline++;
} elsif (/^-/) {
$fromline++;
} elsif (/^[+]/) {
$toline++;
} else {
die;
}
$h{$from}{$fromline}=[$to,$toline];
}
close DIFF or die $ARGV[0];
}
{
local $_;
while (<STDIN>) {
s{[(]([^():\s]+):(\d+)[)]}{
my($basename,$line)=($1,$2);
my $filename="gdb/$basename";
my $r=$h{$filename}{$line};
if ($r) {
die "$filename->".$r->[0] if $r->[0] ne $filename;
$line=$r->[1];
}
"($basename:$line)";
}e;
print;
}
}