This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc/Makefile.in targets 'compare' and 'gnucompare' behave differently
On Fri, Oct 25, 2002 at 05:17:42PM -0700, Zack Weinberg wrote:
> On Fri, Oct 25, 2002 at 06:57:07PM -0400, DJ Delorie wrote:
> >
> > > for file in *.o; do \
> > > test -f stage$stage/$file && (cmp --ignor...bad_compare) || true; \
> > > done
> >
> > That adds back in some of the overhead, unless we assume that the
> > shell is running the test command internally.
>
> I think that's a safe assumption with any modern shell
I agree.
> > Otherwise, I can't think of a better way, unless we can check for
> > cmp's exit code being exactly 1 (it returns 2 if one of the files is
> > missing).
>
> for file in *.o; do \
> cmp ...
> if [ $? -eq 1 ] ; then
> # bad
> fi
> done
I've just finished testing
for file in *.o; do \
cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \
test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
done
and this performs correctly when a file is missing from the stage*
subdirectory. It also maintains the low overhead; 'make gnucompare'
continues to take about one-third to one-fourth the time of 'make compare'.
I'll post a patch tomorrow after some sleep.
Phil
--
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
- Edsger Dijkstra, 1930-2002