system.h: Always prototype abort.

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.

From-SVN: r26511
This commit is contained in:
Zack Weinberg 1999-04-16 19:52:44 +00:00 committed by Zack Weinberg
parent bf69fb7efc
commit 2a611d21ac
21 changed files with 89 additions and 83 deletions

View File

@ -1,3 +1,21 @@
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.
Sat Apr 17 11:25:44 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* config/c4x/c4x.md (mulqf3_clrqf_clobber, mulqi3_clrqi_clobber):

View File

@ -124,7 +124,6 @@ Boston, MA 02111-1307, USA. */
do { \
extern int flag_signed_bitfields; \
flag_signed_bitfields = 0; \
abort_helper (); \
optimization_options (LEVEL,SIZE); \
} while (0)
@ -220,23 +219,6 @@ Boston, MA 02111-1307, USA. */
#endif /* CROSS_COMPILE */
#if !defined (no_abort) || defined (CRT_BEGIN) || defined (CRT_END)
#undef abort
char insn; int insn_; char * file_; int line_;
#define abort() \
(insn_ = (int) insn, \
file_ = __FILE__, \
line_ = __LINE__, \
fancy_abort ())
#define abort_helper() \
do { \
extern void abort_aux (); \
atexit (abort_aux); \
} while (0)
#define _abort_aux
#endif /* no abort */
/* The maximum alignment which the object file format can support.
page alignment would seem to be enough */
#undef MAX_OFILE_ALIGNMENT

View File

@ -32,14 +32,3 @@ Boston, MA 02111-1307, USA. */
#if defined (__GNUC__) && __GNUC__ == 1
#define alloca __builtin_alloca
#endif
#if 0 /* I don't want individual ports to be inconsistent about this.
I regard fancy_abort as a half-solution and not the right way
to do things. --rms. */
/* The m88k and mips ports make use of fancy_abort to give possibly helpful
abort information rather than just dumping core. They do it in their
tm-* files. It seems more logical that this is a characteristic of
the host machine and not the target machine, so we do it here. */
#define abort fancy_abort /* give possibly helpful abort info */
#endif

View File

@ -204,8 +204,6 @@ static void pfatal_with_name PROTO((const char *)) ATTRIBUTE_NORETURN;
static void perror_with_name PROTO((const char *));
static void pfatal_pexecute PROTO((const char *, const char *))
ATTRIBUTE_NORETURN;
static void fatal PVPROTO((const char *, ...))
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1;
static void error PVPROTO((const char *, ...))
ATTRIBUTE_PRINTF_1;
static void notice PVPROTO((const char *, ...))
@ -5324,7 +5322,7 @@ fancy_abort ()
/* Output an error message and exit */
static void
void
fatal VPROTO((const char *msgid, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -45,6 +45,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "intl.h"
#undef abort
#include "gcov-io.h"

View File

@ -31,7 +31,7 @@ struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -224,7 +224,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -119,7 +119,7 @@ struct obstack *temp_obstack = &obstack2;
/* Define this so we can link with print-rtl.o to get debug_rtx function. */
char **insn_name_ptr = 0;
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -5904,7 +5904,7 @@ copy_rtx_unchanging (orig)
#endif
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -33,7 +33,7 @@ struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -82,7 +82,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -49,7 +49,7 @@ static int max_insns_per_split = 1;
static int clobbers_seen_this_insn;
static int dup_operands_seen_this_insn;
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -271,7 +271,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -30,7 +30,7 @@ struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -705,7 +705,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -98,7 +98,7 @@ static struct code_ptr *peepholes;
static void gen_insn PROTO ((rtx));
static void walk_rtx PROTO ((rtx, const char *));
static void print_path PROTO ((char *));
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO ((void)) ATTRIBUTE_NORETURN;
@ -370,7 +370,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -33,7 +33,7 @@ struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -202,7 +202,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */
#include "hconfig.h"
#include "system.h"
#undef abort
#define NO_GENRTL_H
#include "rtl.h"

View File

@ -30,7 +30,7 @@ struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -307,7 +307,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -107,7 +107,7 @@ struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
static void error PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1;
@ -928,7 +928,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -46,7 +46,7 @@ struct link
int vecelt;
};
static void fatal PVPROTO ((const char *, ...))
void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -410,7 +410,7 @@ xrealloc (old, size)
return ptr;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -193,7 +193,7 @@ static void write_tree PROTO((struct decision *, const char *,
struct decision *, int,
enum routine_type));
static void change_state PROTO((const char *, const char *, int));
static void fatal PVPROTO((const char *, ...))
void fatal PVPROTO((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
@ -1697,7 +1697,7 @@ xmalloc (size)
return val;
}
static void
void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES

View File

@ -59,6 +59,7 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "intl.h"
#undef abort
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (_UWIN)
#if defined(POSIX) || defined(CONCURRENT)

View File

@ -378,40 +378,27 @@ extern int setrlimit ();
#endif
/* Redefine abort to report an internal error w/o coredump, and reporting the
location of the error in the source file. */
#ifndef abort
#ifndef __STDC__
#ifndef __GNUC__
#ifndef USE_SYSTEM_ABORT
#define USE_SYSTEM_ABORT
#endif /* !USE_SYSTEM_ABORT */
#endif /* !__GNUC__ */
#endif /* !__STDC__ */
#ifdef USE_SYSTEM_ABORT
# ifdef NEED_DECLARATION_ABORT
location of the error in the source file.
Some files undefine abort again, so we must prototype the real thing
for their sake. */
#ifdef NEED_DECLARATION_ABORT
extern void abort ();
# endif
#else
#endif
extern void fatal PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
#define abort() \
(fprintf (stderr, \
"%s:%d: Internal compiler error\n", __FILE__, __LINE__), \
exit (FATAL_EXIT_CODE))
#define abort() fatal ("Internal compiler error at %s:%d\n", \
trim_filename (__FILE__), __LINE__)
#else
#define abort() \
(fprintf (stderr, \
"%s:%d: Internal compiler error in function %s\n" \
"Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.\n" \
"See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.\n", \
__FILE__, __LINE__, __PRETTY_FUNCTION__), \
exit (FATAL_EXIT_CODE))
#define abort() fatal ("Internal compiler error in `%s', at %s:%d\n" \
"Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.\n" \
"See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.", \
__PRETTY_FUNCTION__, trim_filename (__FILE__), __LINE__)
#endif /* recent gcc */
#endif /* USE_SYSTEM_ABORT */
#endif /* !abort */
/* trim_filename is in toplev.c. Define a stub macro for files that
don't link toplev.c. toplev.h will reset it to the real version. */
#define trim_filename(x) (x)
/* Define a STRINGIFY macro that's right for ANSI or traditional C.
HAVE_CPP_STRINGIFY only refers to the stage1 compiler. Assume that

View File

@ -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.

View File

@ -111,4 +111,7 @@ extern void fnotice PROTO ((FILE *, const char *, ...))
ATTRIBUTE_PRINTF_2;
#endif
#undef trim_filename
extern const char *trim_filename PROTO ((const char *));
#endif /* __GCC_TOPLEV_H */