Skip to content

Commit

Permalink
Merge branch 'master' of github.com:csmith-project/creduce
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyang78 committed Jul 24, 2016
2 parents 2817331 + 8d72e0f commit 092e4ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions creduce/creduce.in
Expand Up @@ -482,7 +482,7 @@ sub wait_helper() {

my $exit_code;
if ($proc->GetExitCode($exit_code) != Win32::Process::STILL_ACTIVE()) {
$? = ($exit_code == 0) ? 1 << 8 : 0;
$? = $exit_code << 8;
return $proc->GetProcessID();
}
push @procs, $proc;
Expand Down Expand Up @@ -819,7 +819,7 @@ my @all_methods = (
{ "name" => "pass_clang", "arg" => "remove-unused-function", "pri" => 220, "first_pass_pri" => 40, },
{ "name" => "pass_clang", "arg" => "remove-unused-enum-member", "pri" => 221, "first_pass_pri" => 51, },
{ "name" => "pass_clang", "arg" => "remove-enum-member-value", "pri" => 222, "first_pass_pri" => 52, },
{ "name" => "pass_clang_binsrch", "arg" => "remove-unused-var", "pri" => 223, "first_pass_pri" => 53, },
{ "name" => "pass_clang", "arg" => "remove-unused-var", "pri" => 223, "first_pass_pri" => 53, },
{ "name" => "pass_clang", "arg" => "simplify-if", "pri" => 224, },
{ "name" => "pass_clang", "arg" => "reduce-array-dim", "pri" => 225, },
{ "name" => "pass_clang", "arg" => "reduce-array-size", "pri" => 226, },
Expand Down
16 changes: 14 additions & 2 deletions creduce/pass_lines.pm
Expand Up @@ -81,10 +81,22 @@ sub transform ($$$) {
if (defined($sh{"start"})) {
print "***TRANSFORM START***\n" if $DEBUG;
delete $sh{"start"};
my $tmpfile = File::Temp::tmpnam();
my $cmd = "$topformflat $arg < $cfile | grep -v '^\\s*\$' > $tmpfile";
my $outfile = File::Temp::tmpnam();
my $cmd = qq{"$topformflat $arg" < $cfile > $outfile};
print $cmd if $DEBUG;
runit ($cmd);

my $tmpfile = File::Temp::tmpnam();
open INF_BLANK, "<$outfile" or die;
open OUTF_BLANK, ">$tmpfile" or die;
while (my $line = <INF_BLANK>) {
if($line !~ /^\s*$/) {
print OUTF_BLANK $line;
}
}
close INF_BLANK;
close OUTF_BLANK;

if (compare($cfile, $tmpfile) == 0) {
# this is a gross hack to avoid tripping the
# pass-didn't-modify-file check in the C-Reduce core, in
Expand Down

0 comments on commit 092e4ad

Please sign in to comment.