Re: [PATCH v3] Expand bitpos and type.length to LONGEST and ULONGEST

Jan Kratochvil
2012-06-08T14:16:59Z

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

On Wed, 06 Jun 2012 23:34:20 +0200, Jan Kratochvil wrote:
> Used:
> rm -rf splint/;mkdir -p splint/bits;touch splint/bits/confname.h;for i in `cat files`;do mkdir -p splint/`dirname $i`;splint +posixlib +gnuextensions -Isplint -exportlocal -DTUI -I. -Icommon -I../include -I../bfd -I../libdecnumber -I../opcodes -I.. -I/usr/include/python2.7 $i &>splint/$i.out;done
> find splint-bitpos/ -type f|sort|xargs cat|perl -lpe 's/^\s*(\S*?\.[ch]:\d+:\d+):/LOC $1\n/' >splint-bitpos.out

> diff -I"^LOC " splint-clean.out splint-bitpos.out|vim -
[...]
> It has 26000 lines this way, I will try to reduce the diff size somehow.

Wrote the attached script and the "diff" has now "just" 7375 lines. This
seems to be reviewable.

Jan

[-- Attachment #2: locdiff --]
[-- Type: text/plain, Size: 1009 bytes --]

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

@ARGV==2 or die;

sub readfile($)
{
my($fname)=@_;

local *F;
open F,$fname or die $fname;
my $F=do { local $/; <F>; };
defined $F or die $fname;
close F or die $fname;
return $F;
}

sub writefile($$)
{
my($fname,$content)=@_;

local *F;
open F,">$fname" or die $fname;
print F $content or die $fname;
close F or die $fname;
}

sub strip($$$)
{
my($dst,$src,$locref)=@_;

my $f=readfile $src;
$f=~s{^LOC (.*)$}{push @$locref,$1;"LOC";}egm;
writefile $dst,$f;
}

my $t="/tmp/locdiff.$$";
my($a,$b)=("$t.a","$t.b");
my(@a,@b);
strip $a,$ARGV[0],\@a;
strip $b,$ARGV[1],\@b;
my $f=readfile "diff -U-1 $a $b||true|";
die if 2!=unlink "$a","$b";
$f=~s{^([-+ ])LOC$}{
my $l;
if ($1 eq "-") {
$l=shift @a;
} elsif ($1 eq "+") {
$l=shift @b;
} else {
die if $1 ne " ";
$l=shift @a;
my $r=shift @b;
$l="$r ($l)" if $l ne $r;
}
"$1LOC $l";
}egm;
1 while $f=~s{^ LOC .*\n(?: .*?\n)*?(.LOC )}{$1}gm;
print $f;