aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZack Weinberg <zack@rabi.columbia.edu>1999-04-16 19:52:44 +0000
committerZack Weinberg <zack@gcc.gnu.org>1999-04-16 19:52:44 +0000
commit2a611d21ac06af33998ac48328847e23ded6b59d (patch)
tree06e7f5db783744cf670101812a22a46a3d9482ea /gcc
parentbf69fb7efcf26ee27067c3225c8ce705ee357c5d (diff)
downloadgcc-2a611d21ac06af33998ac48328847e23ded6b59d.zip
gcc-2a611d21ac06af33998ac48328847e23ded6b59d.tar.gz
gcc-2a611d21ac06af33998ac48328847e23ded6b59d.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/config/i386/dgux.h18
-rw-r--r--gcc/config/m68k/xm-amix.h11
-rw-r--r--gcc/gcc.c4
-rw-r--r--gcc/gcov.c1
-rw-r--r--gcc/genattr.c4
-rw-r--r--gcc/genattrtab.c4
-rw-r--r--gcc/gencodes.c4
-rw-r--r--gcc/genconfig.c4
-rw-r--r--gcc/genemit.c4
-rw-r--r--gcc/genextract.c4
-rw-r--r--gcc/genflags.c4
-rw-r--r--gcc/gengenrtl.c1
-rw-r--r--gcc/genopinit.c4
-rw-r--r--gcc/genoutput.c4
-rw-r--r--gcc/genpeep.c4
-rw-r--r--gcc/genrecog.c4
-rw-r--r--gcc/protoize.c1
-rw-r--r--gcc/system.h45
-rw-r--r--gcc/toplev.c26
-rw-r--r--gcc/toplev.h3
21 files changed, 89 insertions, 83 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e9a584c..d1b12a8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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):
diff --git a/gcc/config/i386/dgux.h b/gcc/config/i386/dgux.h
index 6dfc634..9e41d65 100644
--- a/gcc/config/i386/dgux.h
+++ b/gcc/config/i386/dgux.h
@@ -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
diff --git a/gcc/config/m68k/xm-amix.h b/gcc/config/m68k/xm-amix.h
index c28ed78..72d534f 100644
--- a/gcc/config/m68k/xm-amix.h
+++ b/gcc/config/m68k/xm-amix.h
@@ -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
diff --git a/gcc/gcc.c b/gcc/gcc.c
index f3bb55d..cece9c5 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -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
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 46df6ed..629aa02 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -45,6 +45,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "intl.h"
+#undef abort
#include "gcov-io.h"
diff --git a/gcc/genattr.c b/gcc/genattr.c
index 1157389..55d6fb1 100644
--- a/gcc/genattr.c
+++ b/gcc/genattr.c
@@ -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
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index acba4f7..fcb50c1 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -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
diff --git a/gcc/gencodes.c b/gcc/gencodes.c
index 8c043d2..2658216 100644
--- a/gcc/gencodes.c
+++ b/gcc/gencodes.c
@@ -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
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 9a191e8..9f79e58 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -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
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 5c4cf1e..c7daa1d 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -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
diff --git a/gcc/genextract.c b/gcc/genextract.c
index dc5cbd3..24d3d51 100644
--- a/gcc/genextract.c
+++ b/gcc/genextract.c
@@ -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
diff --git a/gcc/genflags.c b/gcc/genflags.c
index a87b08d..636aafe 100644
--- a/gcc/genflags.c
+++ b/gcc/genflags.c
@@ -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
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c
index 29cb836..bf98a71 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */
#include "hconfig.h"
#include "system.h"
+#undef abort
#define NO_GENRTL_H
#include "rtl.h"
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
index 37db6b9..2cd67b3 100644
--- a/gcc/genopinit.c
+++ b/gcc/genopinit.c
@@ -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
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index 30d1280..2956ec6 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -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
diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index dfba042..65ba963 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -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
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index f135947..546f922 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -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
diff --git a/gcc/protoize.c b/gcc/protoize.c
index 3c5ee62..7e9205c 100644
--- a/gcc/protoize.c
+++ b/gcc/protoize.c
@@ -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)
diff --git a/gcc/system.h b/gcc/system.h
index cdd2bac..3ec73a6 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -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
-#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
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 4c33261..482b956 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.
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 1f40863..d933a7e 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -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 */