gcc/Makefile.in targets 'compare' and 'gnucompare' behave differently

Phil Edwards phil@jaj.com
Tue Oct 29 13:04:00 GMT 2002


On Sat, Oct 26, 2002 at 11:16:45AM +0100, Joseph S. Myers wrote:
> On Sat, 26 Oct 2002, Phil Edwards wrote:
> > I've just finished testing
[...]
> > 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'.
> 
> It would be nice for the gnucompare method to be used automatically (based
> on an autoconf test for cmp --ignore-initial) when GNU cmp is installed.  
> Likewise corresponding cmp features on other systems.

Yes it would, but I'm not currently volunteering to write more autoconf
tests.  I just want the bug fixed.

Here's the formal patch proposal.  Tested on linux-gnu, mainline and 3.2


2002-10-29  Phil Edwards  <pme@gcc.gnu.org>

	* Makefile.in (gnucompare*):  Only record bad comparisons
	if there really was a bad comparison.


Index: Makefile.in
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/gcc/Makefile.in,v
retrieving revision 1.954
diff -u -3 -p -r1.954 Makefile.in
--- Makefile.in	27 Oct 2002 09:14:03 -0000	1.954
+++ Makefile.in	28 Oct 2002 10:10:06 -0000
@@ -3490,18 +3490,21 @@ compare compare3 compare4 compare-lean c
 # Compare the object files in the current directory with those in the
 # stage2 directory.  Use gnu cmp (diffutils v2.4 or later) to avoid
 # running tail and the overhead of twice copying each object file.
-
+# An exit status of 1 is precisely the result we're looking for (other
+# values mean other problems).
 gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force
 	-rm -f .bad_compare
 	case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
 	for file in *$(objext); do \
-	  (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
+	  cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \
+	  test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
 	done
 	case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
 	for dir in tmp-foo intl $(SUBDIRS); do \
 	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
 	    for file in $$dir/*$(objext); do \
-	      (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
+	      cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \
+	      test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
 	    done; \
 	  else true; fi; \
 	done



More information about the Gcc-bugs mailing list