This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[bootstrap-debug]: avoid errors for existing .stripped files


I'd saved some .stripped files for debugging, and from that point on
make bootstrap-debug wouldn't pass any more.  This makes compare-debug
immune to such files left behind, while at the same time not
overwriting them.

I've just checked this in.

for contrib/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* compare-debug: Avoid spurious errors when .stripped files
	exist.

Index: contrib/compare-debug
===================================================================
--- contrib/compare-debug.orig	2007-08-21 03:17:18.000000000 -0300
+++ contrib/compare-debug	2007-08-22 04:10:47.000000000 -0300
@@ -36,31 +36,31 @@ if test ! -f "$2"; then
   exit 1
 fi
 
-if test -f "$1".stripped; then
-  echo "$1".stripped already exists, overwriting >&2
-  exit 1
-fi
+suf1=stripped
+while test -f "$1.$suf1"; do
+  suf1=$suf1.
+done
 
-if test -f "$2".stripped; then
-  echo "$2".stripped already exists, overwriting >&2
-  exit 1
-fi
+suf2=stripped
+while test -f "$2.$suf2"; do
+  suf2=$suf2.
+done
 
-trap 'rm -f "$1".stripped "$2".stripped' 0 1 2 15
+trap 'rm -f "$1.$suf1" "$2.$suf2"' 0 1 2 15
 
-cp "$1" "$1".stripped
-strip "$1".stripped
+cp "$1" "$1.$suf1"
+strip "$1.$suf1"
 
-cp "$2" "$2".stripped
-strip "$2".stripped
+cp "$2" "$2.$suf2"
+strip "$2.$suf2"
 
-if cmp "$1".stripped "$2".stripped; then
+if cmp "$1.$suf1" "$2.$suf2"; then
   status=0
 else
   status=1
 fi
 
-rm -f "$1".stripped "$2".stripped
+rm -f "$1.$suf1" "$2.$suf2"
 
 trap "exit $status; exit" 0 1 2 15
 

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]