This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Don't use slowcompare method unconditionally
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 9 Nov 2005 10:31:31 -0500
- Subject: [PATCH] Don't use slowcompare method unconditionally
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00547.html
patch to avoid tail +16c hasn't moved on and the problem that GCC
doesn't build with unpatched recentish coreutils survives.
The following patch presents just partial solution, but is already
sufficient for the GNU coreutils case.
Before the
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg01800.html
patch make bootstrap was using just the detected method for comparisons,
while after that patch we are using the slowcompare method unconditionally
for checksum and libgcc objects. This patch rearranges it so that
the chosen comparison method is used always and only when it fails, in
common code it detects whether an error or just a warning should be
reported.
Tested with make gnucompare, make fastcompare and make slowcompare,
each time with objects from a bootstrap, then with one . dir object modified
by hand and then with one libgcc/ dir object modified.
Ok for HEAD?
As follow up patch, I think we could introduce another *compare method,
say posixcompare that would use tail -c +16 rather than tail +16c and
add configury to select one of them as the default.
2005-11-09 Jakub Jelinek <jakub@redhat.com>
* Makefile.in (gnucompare): Do comparison of all files using one of
the chosen methods and only afterwards decide if just warning should
be issued or comparison failure raised.
--- gcc/Makefile.in.jj 2005-11-06 13:28:19.000000000 +0100
+++ gcc/Makefile.in 2005-11-08 20:53:23.000000000 +0100
@@ -4241,30 +4241,30 @@ fastcompare fastcompare3 fastcompare4 fa
for dir in . $(SUBDIRS) libgcc; do \
if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
for file in $$dir/*$(objext); do \
- case $$file in \
- ./cc*-checksum$(objext) | libgcc/* ) \
- tail +16c ./$$file > tmp-foo1 \
- && tail +16c stage$$stage/$$file > tmp-foo2 \
- && ( cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 \
- || echo warning: $$file differs || true ) \
+ case "$@" in \
+ slowcompare* ) \
+ tail +16c ./$$file > tmp-foo1; \
+ tail +16c stage$$stage/$$file > tmp-foo2; \
+ cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1; \
+ cmpret=$$?; \
+ ;; \
+ fastcompare* ) \
+ cmp $$file stage$$stage/$$file 16 16 > /dev/null 2>&1; \
+ cmpret=$$?; \
+ ;; \
+ gnucompare* ) \
+ cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \
+ cmpret=$$?; \
;; \
- *) case "$@" in \
- slowcompare* ) \
- tail +16c ./$$file > tmp-foo1; \
- tail +16c stage$$stage/$$file > tmp-foo2 \
- && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 \
- || echo $$file differs >> .bad_compare) || true; \
- ;; \
- fastcompare* ) \
- cmp $$file stage$$stage/$$file 16 16 > /dev/null 2>&1; \
- test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
- ;; \
- gnucompare* ) \
- cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \
- test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
- ;; \
- esac ; \
esac ; \
+ if test $$cmpret -eq 1; then \
+ case $$file in \
+ ./cc*-checksum$(objext) | libgcc/* ) \
+ echo warning: $$file differs;; \
+ *) \
+ echo $$file differs >> .bad_compare;; \
+ esac ; \
+ fi; \
done; \
else true; fi; \
done
Jakub