X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Fllvm-config%2Ffind-cycles.pl;h=5cbf5b4b277609404ac224b3f29ac0ea130df951;hb=adf01b3f18442ae8db6b8948e70d82d9df415119;hp=b6609556bf4e6bf67e4e8b02a54345ae66db356a;hpb=f2722ca33913feb7c0eafe31dc5851a2ab7466fe;p=oota-llvm.git diff --git a/tools/llvm-config/find-cycles.pl b/tools/llvm-config/find-cycles.pl index b6609556bf4..5cbf5b4b277 100755 --- a/tools/llvm-config/find-cycles.pl +++ b/tools/llvm-config/find-cycles.pl @@ -18,6 +18,7 @@ # This file was written by Eric Kidd, and is placed into the public domain. # +use 5.006; use strict; use warnings; @@ -28,7 +29,7 @@ sub find_all_cycles; # Read our dependency information. while (<>) { chomp; - my ($module, $dependency_str) = /^([^:]*): ?(.*)$/; + my ($module, $dependency_str) = /^\s*([^:]+):\s*(.*)\s*$/; die "Malformed data: $_" unless defined $dependency_str; my @dependencies = split(/ /, $dependency_str); $DEPS{$module} = \@dependencies; @@ -39,6 +40,7 @@ find_all_cycles(); # Print out the finished cycles, with their dependencies. my @output; +my $cycles_found = 0; foreach my $cycle (@CYCLES) { my @modules = sort keys %{$cycle}; @@ -56,10 +58,15 @@ foreach my $cycle (@CYCLES) { # Warn about possible linker problems. my @archives = grep(/\.a$/, @modules); if (@archives > 1) { + $cycles_found = $cycles_found + 1; print STDERR "find-cycles.pl: Circular dependency between *.a files:\n"; print STDERR "find-cycles.pl: ", join(' ', @archives), "\n"; - print STDERR "find-cycles.pl: Some linkers may have problems.\n"; push @modules, @archives; # WORKAROUND: Duplicate *.a files. Ick. + } elsif (@modules > 1) { + $cycles_found = $cycles_found + 1; + print STDERR "find-cycles.pl: Circular dependency between *.o files:\n"; + print STDERR "find-cycles.pl: ", join(' ', @modules), "\n"; + push @modules, @modules; # WORKAROUND: Duplicate *.o files. Ick. } # Add to our output. (@modules is already as sorted as we need it to be.) @@ -68,6 +75,7 @@ foreach my $cycle (@CYCLES) { } print sort @output; +exit $cycles_found; #========================================================================== # Depedency Cycle Support