tree-pretty-print.c (dump_location): New.
[gcc.git] / contrib / compare-debug
index c583a59c520ae07633f8e2e23c38aa106ccf78d2..6e979e9d7865844fab944b01226199810ace5f34 100755 (executable)
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
+rm='rm -f'
+
+case $1 in
+-p | --preserve)
+  rm='echo preserving'
+  shift
+  ;;
+esac
+
 if test $# != 2; then
   echo 'usage: compare-debug file1.o file2.o' >&2
   exit 1
@@ -36,31 +45,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 "$1.$suf1" "$2.$suf2"
 
 trap "exit $status; exit" 0 1 2 15