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

Jan Kratochvil
2012-06-08T15:27:57Z

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

On Fri, 08 Jun 2012 16:16:36 +0200, Jan Kratochvil wrote:
> Wrote the attached script and the "diff" has now "just" 7375 lines. This
> seems to be reviewable.

Fixed there some whitespacing issues, therefore:

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
appropriately mv splint splint-clean and mv splint splint-bitpos
find splint-clean/ -type f|sort|xargs cat|perl -lpe 's/^(\s*)(\S*?\.[ch]:\d+:\d+):/$1LOC $2\n/' >splint-clean.out
find splint-bitpos/ -type f|sort|xargs cat|perl -lpe 's/^(\s*)(\S*?\.[ch]:\d+:\d+):/$1LOC $2\n/' >splint-bitpos.out
locdiff splint-clean.out splint-bitpos.out

http://people.redhat.com/jkratoch/locdiff.out

Regards,
Jan

[-- Attachment #2: locdiff --]
[-- Type: text/plain, Size: 1023 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{^(\s*)LOC (.*)$}{push @$locref,$2;"$1LOC";}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{^([-+ ])(\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;
}
"$1$2LOC $l";
}egm;
1 while $f=~s{^ LOC .*\n(?: .*?\n)*?(.LOC )}{$1}gm;
print $f;