cpperror.c, [...]: Never call abort.
authorZack Weinberg <zack@gcc.gnu.org>
Wed, 14 Apr 1999 09:40:56 +0000 (09:40 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Wed, 14 Apr 1999 09:40:56 +0000 (09:40 +0000)
1999-04-14 12:37 -0400  Zack Weinberg  <zack@rabi.columbia.edu>
* cpperror.c, cppexp.c, cpplib.c: Never call abort.
* cpphash.c: Only call abort when we detect corruption of the
malloc arena.
* cppmain.c: Don't define fatal or fancy_abort.

From-SVN: r26442

gcc/ChangeLog
gcc/cpperror.c
gcc/cppexp.c
gcc/cpphash.c
gcc/cpplib.c
gcc/cppmain.c

index 21b0b5cf69fe87ea712e05bf6d509e90698a3670..30745256021e577754fcd7591d1c07b3bde8fe91 100644 (file)
@@ -1,3 +1,10 @@
+1999-04-14 12:37 -0400  Zack Weinberg  <zack@rabi.columbia.edu>
+
+       * cpperror.c, cppexp.c, cpplib.c: Never call abort.
+       * cpphash.c: Only call abort when we detect corruption of the
+       malloc arena.
+       * cppmain.c: Don't define fatal or fancy_abort.
+
 Wed Apr 14 09:19:39 1999  Jan Hubicka <hubicka@freesoft.cz>
 
        * i386.c (x86_adjust_cost): Agi stall takes 1 cycle on Pentium, fst
@@ -36,7 +43,7 @@ Wed Apr 14 00:08:46 1999  Richard Henderson  <rth@cygnus.com>
        * i386.h (memory_address_length): Declare it.
 
 Tue Apr 13 22:52:04 1999  Donn Terry (donn@interix.com)
-                          Martin Heller (Ing.-Buero_Heller@t-online.de)
+                         Martin Heller (Ing.-Buero_Heller@t-online.de)
 
        * configure.in (interix Alpha): Add. 
        (winnt Alpha): Use alpha32.h
@@ -55,7 +62,7 @@ Tue Apr 13 22:52:04 1999  Donn Terry (donn@interix.com)
 
        * config/alpha/xm-alpha-interix.h: New file.
 
-        * config/alpha/t-interix: New file.
+       * config/alpha/t-interix: New file.
 
        * fixinc/mkfixinc.sh (interix/Alpha): Add.
 
index af018815d9338b03ffcbf2030ca69bcc0c963754..c7339dcb8088680fe689e040961ebf81a9ef6e91 100644 (file)
@@ -114,7 +114,7 @@ v_cpp_message (pfile, is_error, msgid, ap)
       pfile->errors = CPP_FATAL_LIMIT;
       break;
     default:
-      abort ();
+      cpp_fatal (pfile, "internal error: bad is_error(%d) in v_cpp_message", is_error);
     }
 
   vfprintf (stderr, _(msgid), ap);
index 24e7c2313d929d495f09e50609411a581167bf84..aef6d195dc63d92dd7c679ffa78c73a7d8ad4400 100644 (file)
@@ -721,7 +721,8 @@ cpp_parse_expr (pfile)
       switch (op.op)
        {
        case NAME:
-         abort ();
+         cpp_fatal (pfile, "internal error: cpp_lex returns a NAME");
+         goto syntax_error;
        case INT:  case CHAR:
          top->value = op.value;
          top->unsignedp = op.unsignedp;
index 06de9d443efb8c7bf5de0ab1af1e002aeb756f8d..6e601a0fd5e3470d4ee5a1212960af8da352ae04 100644 (file)
@@ -26,6 +26,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #include "system.h"
 #include "cpplib.h"
 #include "cpphash.h"
+#undef abort
 
 static int comp_def_part        PARAMS ((int, U_CHAR *, int, U_CHAR *,
                                          int, int));
@@ -290,7 +291,10 @@ collect_expansion (pfile, buf, limit, nargs, arglist)
      that something smarter should happen.  */
 
   if (limit < buf)
-    abort ();
+    {
+      cpp_fatal (pfile, "internal error: limit < buf in collect_expansion");
+      limit = buf; /* treat it like a null defn */
+    }
 
   /* Find the beginning of the trailing whitespace.  */
   p = buf;
@@ -1011,9 +1015,6 @@ special_symbol (hp, pfile)
       cpp_fatal (pfile, "cpplib internal error: invalid special hash type");
       return;
     }
-
-  /* This point should be unreachable. */
-  abort ();
 }
 
 /* Expand a macro call.
@@ -1408,7 +1409,10 @@ macroexpand (pfile, hp)
            }
 
          if (totlen > xbuf_len)
-           abort ();
+           {
+             cpp_fatal (pfile, "internal_error: buffer overrun in macroexpand");
+             return;
+           }
        }
 
       /* if there is anything left of the definition
index 3ed75db1d66a5575b3a0b7feec18e25d972cc875..aa198dd931bc6918b18343be399d9c64e5b485a5 100644 (file)
@@ -836,7 +836,10 @@ cpp_expand_to_buffer (pfile, buf, length)
 #endif
 
   if (length < 0)
-    abort ();
+    {
+      cpp_fatal (pfile, "internal error: length < 0 in cpp_expand_to_buffer");
+      return;
+    }
 
   /* Set up the input on the input stack.  */
 
index 5e3ed90f5b35825235d6e336a17e2f7f123a6dfa..5142cad918f0941be36913b89e9fcfb8b5f85b29 100644 (file)
@@ -37,24 +37,6 @@ char *progname;
 cpp_reader parse_in;
 cpp_options options;
 
-#ifdef abort
-/* More 'friendly' abort that prints the line and file.
-   config.h can #define abort fancy_abort if you like that sort of thing.  */
-void
-fatal (s)
-     char *s;
-{
-  fputs (s, stderr);
-  exit (FATAL_EXIT_CODE);
-}
-
-void
-fancy_abort ()
-{
-  fatal ("Internal gcc abort.");
-}
-#endif
-
 \f
 int
 main (argc, argv)