A few bug fixes.

This commit is contained in:
Patrik Stridvall 2001-07-29 20:19:14 +00:00 committed by Alexandre Julliard
parent 03f3600816
commit 5bc9a0b623
6 changed files with 165 additions and 84 deletions

View File

@ -93,11 +93,18 @@ sub file_normalize {
local $_ = shift; local $_ = shift;
foreach my $dir (split(m%/%, $current_dir)) { foreach my $dir (split(m%/%, $current_dir)) {
s%^(\.\./)*\.\./$dir/%%; if(s%^(\.\./)*\.\./$dir/%%) {
if(defined($1)) { if(defined($1)) {
$_ = "$1$_"; $_ = "$1$_";
} }
} }
}
while(m%^(.*?)([^/\.]+)/\.\./(.*?)$%) {
if($2 ne "." && $2 ne "..") {
$_ = "$1$3";
}
}
return $_; return $_;
} }

View File

@ -7,11 +7,14 @@ BEGIN {
require "$1/winapi/setup.pm"; require "$1/winapi/setup.pm";
} }
use config qw($current_dir $wine_dir); use config qw(
&file_absolutize &file_normalize
$current_dir $wine_dir
);
use output qw($output); use output qw($output);
use make_filter_options qw($options); use make_filter_options qw($options);
use make_parser; use make_parser qw($directory $tool $file $line $message);
if($options->progress) { if($options->progress) {
$output->enable_progress; $output->enable_progress;
@ -23,7 +26,7 @@ if($options->progress) {
# main # main
######################################################################## ########################################################################
my $command = join(" ", $options->arguments); my $command = $options->make . " " . join(" ", $options->arguments);
open(IN, "($command) 2>&1 |"); open(IN, "($command) 2>&1 |");
while(<IN>) { while(<IN>) {
@ -33,35 +36,32 @@ while(<IN>) {
next; next;
} }
my $directory = &make_parser::directory(); if($message) {
my $file = &make_parser::file_name();
my $line = &make_parser::file_line();
my $message = &make_parser::message();
if(&make_parser::tool() eq "make") {
if($directory && $directory ne ".") {
$output->progress("$directory: make");
}
} elsif($message) {
if($file && $line) { if($file && $line) {
if($directory) { if($directory && $directory ne ".") {
$output->write("$directory/$file:$line: $message\n"); $output->write(&file_normalize("$directory/$file") . ":$line: $message\n");
} else { } else {
$output->write("$file:$line: $message\n"); $output->write("$file:$line: $message\n");
} }
} elsif($file) { } elsif($file) {
if($directory) { if($directory && $directory ne ".") {
$output->write("$directory/$file: $message\n"); $output->write(&file_normalize("$directory/$file") . ": $message\n");
} else { } else {
$output->write("$file: $message\n"); $output->write("$file: $message\n");
} }
} else { } else {
if($directory) { if($directory && $directory ne ".") {
$output->write("$directory: " . &make_parser::tool() . ": $message\n"); $output->write("$directory: $tool: $message\n");
} elsif($tool) {
$output->write("$tool: $message\n");
} else { } else {
$output->write(".: " . &make_parser::tool() . ": $message\n"); $output->write("$message\n");
} }
} }
} elsif($tool eq "make") {
if($directory && $directory ne ".") {
$output->progress("$directory: make");
}
} }
} }

View File

@ -10,7 +10,7 @@ require Exporter;
@EXPORT = qw(); @EXPORT = qw();
@EXPORT_OK = qw($options); @EXPORT_OK = qw($options);
use options qw($options &parse_comma_list); use options qw($options &parse_comma_list &parse_value);
my %options_long = ( my %options_long = (
"debug" => { default => 0, description => "debug mode" }, "debug" => { default => 0, description => "debug mode" },
@ -19,6 +19,9 @@ my %options_long = (
"progress" => { default => 1, description => "show progress" }, "progress" => { default => 1, description => "show progress" },
"make" => { default => "make",
parser => \&parse_value,
description => "use which make" },
"pedantic" => { default => 0, description => "be pedantic" }, "pedantic" => { default => 0, description => "be pedantic" },
); );

View File

@ -2,32 +2,39 @@ package make_parser;
use strict; use strict;
use strict;
use setup qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw();
@EXPORT_OK = qw($directory $tool $file $line $message);
use vars qw($directory $tool $file $line $message);
use output qw($output); use output qw($output);
use options qw($options);
######################################################################## ########################################################################
# global # global
######################################################################## ########################################################################
my $current; my $current;
my $tool;
my $directory;
my $file;
my $line;
my $function; my $function;
my $message;
sub directory { return $directory; }
sub tool { return $tool; }
sub file_name { return $file; }
sub file_line { return $line; }
sub message { return $message; }
######################################################################## ########################################################################
# error # error
######################################################################## ########################################################################
sub error { sub error {
if(defined($tool)) {
$output->write("make_filter: $tool: can't parse output: '$current'\n"); $output->write("make_filter: $tool: can't parse output: '$current'\n");
} else {
$output->write("make_filter: <>: can't parse output: '$current'\n");
}
exit 1; exit 1;
} }
@ -50,6 +57,19 @@ sub line {
$function = ""; $function = "";
if($tool =~ /^cd|make$/) {
# Nothing
} elsif($tool =~ /^ld$/) {
foreach my $file (@{$read_files}) {
$output->lazy_progress("$directory: ld: reading '$file'");
}
my $file = $$write_files[0];
$output->progress("$directory: ld: writing '$file'");
} elsif($tool =~ /^rm$/) {
foreach my $file (@{$remove_files}) {
$output->lazy_progress("$directory: rm: removing '$file'");
}
} else {
my $progress = "$directory: $tool: "; my $progress = "$directory: $tool: ";
if($#$read_files >= 0) { if($#$read_files >= 0) {
$progress .= "read[" . join(" ", @{$read_files}) . "]"; $progress .= "read[" . join(" ", @{$read_files}) . "]";
@ -67,23 +87,22 @@ sub line {
$progress .= "remove[" . join(" ", @{$remove_files}) . "]"; $progress .= "remove[" . join(" ", @{$remove_files}) . "]";
} }
if($tool =~ /^cd|make$/) { $output->progress($progress);
# Nothing
} elsif($tool =~ /^ld$/) {
$progress =~ s/read\[.*?\]/read[*.o]/; # FIXME: Kludge
$output->progress($progress)
} else {
$output->progress($progress)
} }
return 0; return 0;
} }
if(/^Wine build complete\.$/) { if(/^Wine build complete\.$/) {
# Nothing # Nothing
} elsif(s/^make\[(\d+)\]:\s*//) { } elsif(/^(.*?) is newer than (.*?), please rerun (.*?)\!$/) {
$message = "$_";
} elsif(/^(.*?) is older than (.*?), please rerun (.*?)$/) {
$message = "$_";
} elsif(s/^make(?:\[(\d+)\])?:\s*//) {
$tool = "make"; $tool = "make";
make_output($1, $_); make_output($1, $_);
} elsif(!defined($tool)) {
error();
} elsif($tool eq "bison" && /^conflicts:\s+\d+\s+shift\/reduce$/) { } elsif($tool eq "bison" && /^conflicts:\s+\d+\s+shift\/reduce$/) {
# Nothing # Nothing
} elsif($tool eq "gcc" && /^In file included from (.+?):(\d+):$/) { } elsif($tool eq "gcc" && /^In file included from (.+?):(\d+):$/) {
@ -101,7 +120,7 @@ sub line {
} elsif($tool eq "cd" && s/^\/bin\/sh:\s*cd:\s*//) { } elsif($tool eq "cd" && s/^\/bin\/sh:\s*cd:\s*//) {
parse_cd_output($_); parse_cd_output($_);
} else { } else {
error($_) error();
} }
$file =~ s/^\.\///; $file =~ s/^\.\///;
@ -123,7 +142,7 @@ sub make_output {
if(0) { if(0) {
# Nothing # Nothing
} elsif(/^\*\*\* \[(.*?)\] Error (\d+)$/) { } elsif(/^\*\*\* \[(.*?)\] Error (\d+)$/) {
# Nothing $message = "$_";
} elsif(/^\*\*\* Warning:\s+/) { # } elsif(/^\*\*\* Warning:\s+/) { #
if(/^File \`(.+?)\' has modification time in the future \((.+?) > \(.+?\)\)$/) { if(/^File \`(.+?)\' has modification time in the future \((.+?) > \(.+?\)\)$/) {
# Nothing # Nothing
@ -150,7 +169,9 @@ sub make_output {
} }
} }
$directory = join("/", @components); $directory = join("/", @components);
} elsif(/^Nothing to be done for \`(.*?)\'.$/) { } elsif(/^(.*?) is older than (.*?), please rerun (.*?)\$/) {
# Nothing
} elsif(/^Nothing to be done for \`(.*?)\'\.$/) {
# Nothing # Nothing
} elsif(s/^warning:\s+//) { } elsif(s/^warning:\s+//) {
if(/^Clock skew detected. Your build may be incomplete.$/) { if(/^Clock skew detected. Your build may be incomplete.$/) {
@ -378,6 +399,8 @@ sub gcc_output {
if(0) { if(0) {
# Nothing # Nothing
} elsif(/^((?:signed |unsigned )?(?:int|long)) format, (different type|\S+) arg \(arg (\d+)\)$/) {
$supress = 0;
} elsif(/^\(near initialization for \`(.*?)\'\)$/) { } elsif(/^\(near initialization for \`(.*?)\'\)$/) {
$supress = 0; $supress = 0;
} elsif(/^\`(.*?)\' defined but not used$/) { } elsif(/^\`(.*?)\' defined but not used$/) {
@ -386,10 +409,16 @@ sub gcc_output {
$supress = 0; $supress = 0;
} elsif(/^\`%x\' yields only last 2 digits of year in some locales$/) { } elsif(/^\`%x\' yields only last 2 digits of year in some locales$/) {
$supress = 1; $supress = 1;
} elsif(/^(.*?) format, different type arg \(arg (\d+)\)$/) { } elsif(/^assignment makes integer from pointer without a cast$/) {
$supress = 0;
} elsif(/^assignment makes pointer from integer without a cast$/) {
$supress = 0; $supress = 0;
} elsif(/^assignment from incompatible pointer type$/) { } elsif(/^assignment from incompatible pointer type$/) {
$supress = 0; $supress = 0;
} elsif(/^cast from pointer to integer of different size$/) {
$supress = 0;
} elsif(/^comparison between pointer and integer$/) {
$supress = 0;
} elsif(/^comparison between signed and unsigned$/) { } elsif(/^comparison between signed and unsigned$/) {
$supress = 0; $supress = 0;
} elsif(/^comparison of unsigned expression < 0 is always false$/) { } elsif(/^comparison of unsigned expression < 0 is always false$/) {
@ -406,18 +435,28 @@ sub gcc_output {
$supress = 0; $supress = 0;
} elsif(/^initialization from incompatible pointer type$/) { } elsif(/^initialization from incompatible pointer type$/) {
$supress = 0; $supress = 0;
} elsif(/^initialization makes pointer from integer without a cast$/) {
$supress = 0;
} elsif(/^missing initializer$/) { } elsif(/^missing initializer$/) {
$supress = 0; $supress = 0;
} elsif(/^ordered comparison of pointer with integer zero$/) { } elsif(/^ordered comparison of pointer with integer zero$/) {
$supress = 0; $supress = 0;
} elsif(/^passing arg (\d+) of pointer to function from incompatible pointer type$/) { } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') from incompatible pointer type$/) {
$supress = 0; $supress = 0;
} elsif(/^passing arg (\d+) of \`(\S+)\' from incompatible pointer type$/) { } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') makes integer from pointer without a cast$/) {
$supress = 0; $supress = 0;
} elsif(/^passing arg (\d+) of \`(\S+)\' makes integer from pointer without a cast$/) { } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') makes pointer from integer without a cast$/) {
$supress = 0;
} elsif(/^return makes integer from pointer without a cast$/) {
$supress = 0;
} elsif(/^return makes pointer from integer without a cast$/) {
$supress = 0; $supress = 0;
} elsif(/^type of \`(.*?)\' defaults to \`(.*?)\'$/) { } elsif(/^type of \`(.*?)\' defaults to \`(.*?)\'$/) {
$supress = 0; $supress = 0;
} elsif(/^unused variable \`(.*?)\'$/) {
$supress = 0;
} elsif(!$options->pedantic) {
$supress = 0;
} else { } else {
error(); error();
} }
@ -435,11 +474,17 @@ sub gcc_output {
$message = "$_"; $message = "$_";
} elsif(/^\(Each undeclared identifier is reported only once$/) { } elsif(/^\(Each undeclared identifier is reported only once$/) {
$message = "$_"; $message = "$_";
} elsif(/^conflicting types for \`(.*?)\'$/) {
$message = "$_";
} elsif(/^for each function it appears in.\)$/) { } elsif(/^for each function it appears in.\)$/) {
$message = "$_"; $message = "$_";
} elsif(/^too many arguments to function$/) {
$message = "$_";
} elsif(/^previous declaration of \`(.*?)\'$/) {
$message = "$_";
} elsif(/^parse error before `(.*?)'$/) { } elsif(/^parse error before `(.*?)'$/) {
$message = "$_"; $message = "$_";
} elsif(/^$/) { } elsif(!$options->pedantic) {
$message = "$_"; $message = "$_";
} else { } else {
error(); error();

View File

@ -7,13 +7,16 @@ require Exporter;
@ISA = qw(Exporter); @ISA = qw(Exporter);
@EXPORT = qw(); @EXPORT = qw();
@EXPORT_OK = qw($options &parse_comma_list); @EXPORT_OK = qw($options &parse_comma_list &parse_value);
use vars qw($options); use vars qw($options);
use output qw($output);
sub parse_comma_list { sub parse_comma_list {
my $prefix = shift; my $prefix = shift;
my $value = shift; my $value = shift;
if(defined($prefix) && $prefix eq "no") { if(defined($prefix) && $prefix eq "no") {
return { active => 0, filter => 0, hash => {} }; return { active => 0, filter => 0, hash => {} };
} elsif(defined($value)) { } elsif(defined($value)) {
@ -27,6 +30,13 @@ sub parse_comma_list {
} }
} }
sub parse_value {
my $prefix = shift;
my $value = shift;
return $value;
}
package _options; package _options;
use strict; use strict;

View File

@ -12,24 +12,27 @@ BEGIN {
use vars qw($current_dir $wine_dir $winapi_dir $winapi_check_dir); use vars qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
my $dir; my $tool = $0;
my $tool; $tool =~ s%^(?:.*?/)?([^/]+)$%$1%;
if($0 =~ m%^((.*?)/?tools/([^/]+))/([^/]+)$%) if(defined($current_dir) && defined($wine_dir) &&
defined($winapi_dir) && defined($winapi_check_dir))
{ {
$winapi_dir = $1; # Nothing
$winapi_check_dir = $1; } elsif($0 =~ m%^(.*?)/?tools/([^/]+)/[^/]+$%) {
$dir = $3; my $dir = $2;
$tool = $4;
if(defined($2) && $2 ne "") if(defined($1) && $1 ne "")
{ {
$wine_dir = $2; $wine_dir = $1;
} else { } else {
$wine_dir = "."; $wine_dir = ".";
} }
require Cwd;
my $cwd = Cwd::cwd();
if($wine_dir =~ /^\./) { if($wine_dir =~ /^\./) {
$current_dir = "."; $current_dir = ".";
my $pwd; chomp($pwd = `pwd`); my $pwd; chomp($pwd = `pwd`);
@ -38,19 +41,32 @@ BEGIN {
$current_dir = "$1/$current_dir"; $current_dir = "$1/$current_dir";
} }
$current_dir =~ s%/\.$%%; $current_dir =~ s%/\.$%%;
} elsif($wine_dir eq $cwd) {
$wine_dir = ".";
$current_dir = ".";
} elsif($cwd =~ m%^$wine_dir/(.*?)?$%) {
$current_dir = $1;
$wine_dir = ".";
foreach my $dir (split(m%/%, $current_dir)) {
$wine_dir = "../$wine_dir";
} }
$wine_dir =~ s%/\.$%%;
$winapi_dir =~ s%^\./%%;
$winapi_dir =~ s/$dir/winapi/g;
$winapi_check_dir =~ s%^\./%%;
$winapi_check_dir =~ s/$dir/winapi_check/g;
} else { } else {
print STDERR "$tool: You must run this tool in the main Wine directory or a sub directory\n"; print STDERR "$tool: You must run this tool in the main Wine directory or a sub directory\n";
exit 1; exit 1;
} }
$winapi_dir = "$wine_dir/tools/winapi";
$winapi_dir =~ s%^\./%%;
$winapi_check_dir = "$wine_dir/tools/winapi_check";
$winapi_check_dir =~ s%^\./%%;
push @INC, ($winapi_dir, $winapi_check_dir); push @INC, ($winapi_dir, $winapi_check_dir);
} else {
print STDERR "$tool: You must run this tool in the main Wine directory or a sub directory\n";
exit 1;
}
} }
1; 1;