+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):
do { \
extern int flag_signed_bitfields; \
flag_signed_bitfields = 0; \
- abort_helper (); \
optimization_options (LEVEL,SIZE); \
} while (0)
#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
#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
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 *, ...))
\f
/* Output an error message and exit */
-static void
+void
fatal VPROTO((const char *msgid, ...))
{
#ifndef ANSI_PROTOTYPES
#include "config.h"
#include "system.h"
#include "intl.h"
+#undef abort
#include "gcov-io.h"
#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;
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
/* 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;
#endif
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
#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;
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
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;
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
#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;
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
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;
\f
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
#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;
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
#include "hconfig.h"
#include "system.h"
+#undef abort
#define NO_GENRTL_H
#include "rtl.h"
#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;
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
#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;
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
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;
return ptr;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
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;
\f
return val;
}
-static void
+void
fatal VPROTO ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
#include "system.h"
#include "intl.h"
+#undef abort
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (_UWIN)
#if defined(POSIX) || defined(CONCURRENT)
#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
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#define abort() \
-(fprintf (stderr, \
- "%s:%d: Internal compiler error\n", __FILE__, __LINE__), \
- exit (FATAL_EXIT_CODE))
+#endif
+extern void fatal PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+#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
#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))
va_end (ap);
}
\f
+/* 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.
ATTRIBUTE_PRINTF_2;
#endif
+#undef trim_filename
+extern const char *trim_filename PROTO ((const char *));
+
#endif /* __GCC_TOPLEV_H */