diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-08-26 05:18:44 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-08-26 05:18:44 +0000 |
commit | dda908156c671a94c14d8e92bfec8cc101b1ab2f (patch) | |
tree | d44a531d6d8a1d3b4f321e6fc43e9e6dbb2f1277 /gcc/rtl.c | |
parent | 2ee035782f88d1c2cf372cd941a0a1704d2ebd4b (diff) | |
download | gcc-dda908156c671a94c14d8e92bfec8cc101b1ab2f.tar.gz |
1999-08-25 22:10 -0700 Zack Weinberg <zack@bitmover.com>
* system.h: Don't redefine abort or trim_filename.
* rtl.h: Define abort to fancy_abort (__FILE__, __LINE__, 0)
or fancy_abort (__FILE__, __LINE__, __FUNCTION__) depending on
whether or not __FUNCTION__ is available.
* tree.h: Duplicate rtl.h's definition of abort, for files
that don't include rtl.h. Delete all code to perform type
checking with a compiler other than GCC.
* varray.h: Delete all code to perform type checking with a
compiler other than GCC. Make VARRAY_CHECK() always evaluate
its arguments exactly once, using a statement expression.
Adjust the VARRAY_<type> accessor macros to match.
* toplev.h (fatal_insn, fatal_insn_not_found): Kill.
(_fatal_insn, _fatal_insn_not_found): New fns, take info on
caller's location. Define fatal_insn and fatal_insn_not_found
as macros that use _fatal_insn and _fatal_insn_not_found.
(fancy_abort, trim_filename): Kill prototypes.
* rtl.c (trim_filename): Move here from toplev.c.
(fancy_abort): New function.
(DIR_SEPARATOR): Provide default definition.
* tree.c (tree_check_failed, tree_class_check_failed): Go
through fancy_abort.
(tree_check, tree_class_check, cst_or_constructor_check,
expr_check): Delete.
* varray.c (varray_check_failed): New function.
* toplev.c (fatal_insn, fatal_insn_not_found): Replace with
_fatal_insn and _fatal_insn_not_found. Go through
fancy_abort.
(trim_filename, fancy_abort): Delete.
* builtins.c (expand_builtin_args_info): Report ICE with abort.
* except.c (start_catch_handler): Report ICE with error/abort
combo.
* final.c (output_operand_lossage): Likewise.
* flow.c (verify_flow_info): Likewise.
* gcc.c: Prototype fatal.
* gengenrtl.c: Undef abort after including rtl.h not system.h.
* genattr.c, genattrtab.c, genemit.c, genextract.c,
genflags.c, genopinit.c, genoutput.c, genpeep.c, genrecog.c:
Don't define fancy_abort.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28889 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r-- | gcc/rtl.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc/rtl.c b/gcc/rtl.c index bf997509f78..e50d5a759c7 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -29,6 +29,10 @@ Boston, MA 02111-1307, USA. */ #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + /* Obstack used for allocating RTL objects. Between functions, this is the permanent_obstack. While parsing and expanding a function, this is maybepermanent_obstack @@ -962,3 +966,53 @@ init_rtl () } } } + +/* These are utility functions used by fatal-error functions all over the + code. rtl.c happens to be linked by all the programs that need them, + so these are here. In the future we want to break out all error handling + to its own module. */ + +/* Given a partial pathname as input, return another pathname that + shares no directory elements with the pathname of __FILE__. This + is used by fancy_abort() to print `Internal compiler error in expr.c' + instead of `Internal compiler error in ../../egcs/gcc/expr.c'. */ +static 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; +} + +/* Report an internal compiler error in a friendly manner and without + dumping core. There are two versions because __FUNCTION__ isn't + available except in gcc 2.7 and later. */ + +extern void fatal PVPROTO ((const char *, ...)) + ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; + +void +fancy_abort (file, line, function) + const char *file; + int line; + const char *function; +{ + if (function == NULL) + function = "?"; + fatal ( +"Internal compiler error in `%s', at %s:%d\n\ +Please submit a full bug report.\n\ +See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> \ +for instructions.", + function, trim_filename (file), line); +} |