]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
system.h: Always prototype abort.
authorZack Weinberg <zack@rabi.columbia.edu>
Fri, 16 Apr 1999 19:52:44 +0000 (19:52 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Fri, 16 Apr 1999 19:52:44 +0000 (19:52 +0000)
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

21 files changed:
gcc/ChangeLog
gcc/config/i386/dgux.h
gcc/config/m68k/xm-amix.h
gcc/gcc.c
gcc/gcov.c
gcc/genattr.c
gcc/genattrtab.c
gcc/gencodes.c
gcc/genconfig.c
gcc/genemit.c
gcc/genextract.c
gcc/genflags.c
gcc/gengenrtl.c
gcc/genopinit.c
gcc/genoutput.c
gcc/genpeep.c
gcc/genrecog.c
gcc/protoize.c
gcc/system.h
gcc/toplev.c
gcc/toplev.h

index e9a584c11dccee0b3674da3037db01346569ac50..d1b12a80fad00461cb8fe4aca8652de2dda95611 100644 (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): 
index 6dfc63425196d503ced77fde475b934be5383a48..9e41d6512b86a53a3807c315c2178d9f67ecd4f3 100644 (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
index c28ed787cadfcb2c66b0d7cc0ebe034d00d446fd..72d534fe6191fa5382d7274b65d0d3e71ad1c1db 100644 (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
index f3bb55d1e4278434b22721a3717080cff3c64655..cece9c57475f47c786adb988bce09d9ff7403baf 100644 (file)
--- 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 ()
 \f
 /* Output an error message and exit */
 
-static void
+void
 fatal VPROTO((const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
index 46df6ede862a5d9e6aea38e4e4a41890f7c0ec5a..629aa0239853a33d9a28497cad58ccd7b5749bce 100644 (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"
 
index 1157389fdf09a2765c48753f4e809892fffc5fc0..55d6fb1996d5607aafaf74e629c0aec8dc41c309 100644 (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
index acba4f793277a37c31c2d9ea75a7097df18ad01f..fcb50c13a8290119749a167fffce8b1983e597a5 100644 (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
index 8c043d2848ab9b2b9d7aa6fd18e972fd6ee83173..2658216760e46bc45340f91fe8ea60bd9f850049 100644 (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
index 9a191e8fd59352779437dbc2104bf4c235564e4b..9f79e5882e11dab8ced826b3726cd97b86b1f1d4 100644 (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
index 5c4cf1ea67ce4fcd8d18d36a5d4b7c349144f23d..c7daa1dfd9954944a0c9a3f57b7cf32e22eb83c5 100644 (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
index dc5cbd36ea52abe6c82972dda36b187aed41fa72..24d3d511975da3d49d5a3f1d411b58a3f91f90e1 100644 (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;
 \f
@@ -370,7 +370,7 @@ xrealloc (old, size)
   return ptr;
 }
 
-static void
+void
 fatal VPROTO ((const char *format, ...))
 {
 #ifndef ANSI_PROTOTYPES
index a87b08de2878aeadcacf354910367399cfe6ff25..636aafeed57320801685c8433e7d13e844f1ee9b 100644 (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
index 29cb836df448cb1f4c628f8965d6c4db12b5941c..bf98a716770d3293b5ab5fd6d4b7d1298dfce012 100644 (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"
index 37db6b964e30e6afe4e4a5f1b35abc8115e0b643..2cd67b31866e17bc74094d5bff5f2285aff3fca1 100644 (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
index 30d1280b76d733eb0c667c7b5beed181fde4bdeb..2956ec6594ce15dbad6d76e04da497bc85c0b2c8 100644 (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
index dfba042e9b5179ac0fc88b8241e2cc03511141d2..65ba963c056e6737760161ac3bc12a60f4e43b3b 100644 (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
index f1359470b6b28e60ef1b71d34df073490661cb2d..546f922cccb504c2be202fe30212c64bcdbf2576 100644 (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;
 \f
@@ -1697,7 +1697,7 @@ xmalloc (size)
   return val;
 }
 
-static void
+void
 fatal VPROTO ((const char *format, ...))
 {
 #ifndef ANSI_PROTOTYPES
index 3c5ee622f51ea6c1f8b4881c2daa0b297158bbbf..7e9205cb1a821c4a305e30db50ed838816f94ab3 100644 (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)
index cdd2bac7b52a5ee26324b116debf11c1adbe2171..3ec73a6cab1fe7d4d062e8bfd4a4278b798bd292 100644 (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
-#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
index 4c332617966b3d92575bdeb8c028c61614fdea8f..482b956795cfea210c3cd5c3acc6a630f57ccbf3 100644 (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);
 }
 \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.
 
index 1f4086377197ded23fcb386540c93311f7490382..d933a7e803eaa1d5b47a0dc0ad01bd8818b6fc68 100644 (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 */