summaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-16 19:52:44 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-16 19:52:44 +0000
commitef5ed00c36d75e8f60216dbeb29f5f266837ab0d (patch)
tree06e7f5db783744cf670101812a22a46a3d9482ea /gcc/toplev.c
parente4e9a13904463f0b319835dfab2a8f926021165e (diff)
downloadgcc-ef5ed00c36d75e8f60216dbeb29f5f266837ab0d.tar.gz
1999-04-16 22:44 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* system.h: Always prototype abort. Prototype fatal. Define abort to call fatal, not fprintf/exit. Define a stub macro for trim_filename. * toplev.c: Define DIR_SEPARATOR. (trim_filename): New function. * toplev.h: Prototype trim_filename, and #undef system.h's stub. * gcc.c, genattr.c, genattrtab.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c, genrecog.c: Make fatal non-static. * gcov.c, gengenrtl.c, protoize.c: #undef abort after including system.h. * config/i386/dgux.h, config/m68k/xm-amix.h: Remove stale code relating to abort. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26511 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 4c332617966..482b956795c 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -132,6 +132,10 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
#define PREFERRED_DEBUGGING_TYPE NO_DEBUG
#endif
+#ifndef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#endif
+
extern int rtx_equal_function_value_matters;
#if ! (defined (VMS) || defined (OS2))
@@ -2221,6 +2225,28 @@ sorry VPROTO((const char *msgid, ...))
va_end (ap);
}
+/* Given a partial pathname as input, return another pathname that shares
+ no elements with the pathname of __FILE__. This is used by abort() to
+ print `Internal compiler error in expr.c' instead of `Internal compiler
+ error in ../../egcs/gcc/expr.c'. */
+const char *
+trim_filename (name)
+ const char *name;
+{
+ static const char *this_file = __FILE__;
+ const char *p = name, *q = this_file;
+
+ while (*p == *q && *p != 0 && *q != 0) p++, q++;
+ while (p > name && p[-1] != DIR_SEPARATOR
+#ifdef DIR_SEPARATOR_2
+ && p[-1] != DIR_SEPARATOR_2
+#endif
+ )
+ p--;
+
+ return p;
+}
+
/* More 'friendly' abort that prints the line and file.
config.h can #define abort fancy_abort if you like that sort of thing.