diagnostic.c (finish_abort): New fn.
authorJason Merrill <jason@gcc.gnu.org>
Wed, 15 Nov 2000 15:50:51 +0000 (10:50 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 15 Nov 2000 15:50:51 +0000 (10:50 -0500)
        * diagnostic.c (finish_abort): New fn.
        (fancy_abort, error_recursion): Use it.
        * toplev.c (crash_signal): Likewise.
        * diagnostic.h: Declare it.

        * typeck2.c (friendly_abort): Uncount the error before handing
        off to fancy_abort.

From-SVN: r37480

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/typeck2.c
gcc/diagnostic.c
gcc/diagnostic.h
gcc/toplev.c

index 69ad2e9..7f461b5 100644 (file)
@@ -1,3 +1,10 @@
+2000-11-15  Jason Merrill  <jason@redhat.com>
+
+       * diagnostic.c (finish_abort): New fn.
+       (fancy_abort, error_recursion): Use it.
+       * toplev.c (crash_signal): Likewise.
+       * diagnostic.h: Declare it.
+
 2000-11-13  Andrew Haley  <aph@redhat.com>
 
        * tree.c (build_type_no_quals): New function.
@@ -179,17 +186,17 @@ Tue Nov 14 12:34:56 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
 2000-11-13  Neil Booth  <neilb@earthling.net>
 
-        * cpplex.c (_cpp_lex_token): CPP_COMMENT and true CPP_EOF
-        cases return without MI check.
-        * cpplib.c (do_diagnostic): Take boolean of whether to
-        print the directive name.
-        (do_error, do_warning): Update.
-        (do_pragma_dependency): Use it.
-        * cpplib.h (VARARGS_FIRST): Delete.
-        (struct cpp_token): Delete integer.
-        * cppmacro.c (enter_macro_context): Move disabled check
-        to _cpp_get_token.
-        (_cpp_get_token): Simplify into a single loop.
+       * cpplex.c (_cpp_lex_token): CPP_COMMENT and true CPP_EOF
+       cases return without MI check.
+       * cpplib.c (do_diagnostic): Take boolean of whether to
+       print the directive name.
+       (do_error, do_warning): Update.
+       (do_pragma_dependency): Use it.
+       * cpplib.h (VARARGS_FIRST): Delete.
+       (struct cpp_token): Delete integer.
+       * cppmacro.c (enter_macro_context): Move disabled check
+       to _cpp_get_token.
+       (_cpp_get_token): Simplify into a single loop.
 
 2000-11-13  Richard Earnshaw  <rearnsha@arm.com>
 
index 881ad2b..c5a369c 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-15  Jason Merrill  <jason@redhat.com>
+
+       * typeck2.c (friendly_abort): Uncount the error before handing
+       off to fancy_abort.
+
 2000-11-15  Nathan Sidwell  <nathan@codesourcery.com>
 
        * typeck.c (lookup_anon_field): Cope with qv qualifiers.
index 9141c6f..b030a05 100644 (file)
@@ -259,6 +259,9 @@ friendly_abort (where, file, line, func)
   if (where > 0)
     error ("Internal error #%d.", where);
 
+  /* Uncount this error, so finish_abort will do the right thing.  */
+  --errorcount;
+
   fancy_abort (file, line, func);
 }
 
index 26ffa02..036b1ce 100644 (file)
@@ -1638,11 +1638,8 @@ error_recursion ()
     finish_diagnostic ();
 
   fprintf (stderr,
-"Internal compiler error: Error reporting routines re-entered.\n\
-Please submit a full bug report.\n\
-See %s for instructions.\n", GCCBUGURL);
-
-  exit (FATAL_EXIT_CODE);
+          "Internal compiler error: Error reporting routines re-entered.");
+  finish_abort ();
 }
 
 /* Given a partial pathname as input, return another pathname that
@@ -1676,11 +1673,27 @@ fancy_abort (file, line, function)
      int line;
      const char *function;
 {
-  fatal (
-"Internal compiler error in %s, at %s:%d\n\
+  error ("Internal compiler error in %s, at %s:%d",
+        function, trim_filename (file), line);
+  finish_abort ();
+}
+
+/* Finish reporting an internal compiler error.  If the only error we've
+   seen is the current one, encourage the user to file a bug report;
+   otherwise, fixing their code will probably avoid the crash.  */
+
+void
+finish_abort ()
+{
+  if (errorcount > 1 || sorrycount > 0)
+    fprintf (stderr, "confused by earlier errors, bailing out\n");
+  else
+    fprintf (stderr, "\
 Please submit a full bug report.\n\
-See %s for instructions.",
-        function, trim_filename (file), line, GCCBUGURL);
+See %s for instructions.\n",
+          GCCBUGURL);
+
+  exit (FATAL_EXIT_CODE);
 }
 
 /* Setup DC for reporting a diagnostic MESSAGE (an error of a WARNING),
index 6d693fc..5abae7b 100644 (file)
@@ -207,5 +207,6 @@ void record_last_error_module   PARAMS ((void));
 int error_function_changed      PARAMS ((void));
 void record_last_error_function PARAMS ((void));
 void report_problematic_module  PARAMS ((output_buffer *));     
+void finish_abort              PARAMS ((void)) ATTRIBUTE_NORETURN;
 
 #endif /* __GCC_DIAGNOSTIC_H__ */
index 1f46f35..95955fb 100644 (file)
@@ -1685,9 +1685,8 @@ crash_signal (signo)
      /* If this is missing, some compilers complain.  */
      int signo;
 {
-  fatal ("Internal error: %s.\n\
-Please submit a full bug report.\n\
-See %s for instructions.", strsignal (signo), GCCBUGURL);
+  error ("Internal error: %s.", strsignal (signo));
+  finish_abort ();
 }
 
 /* Strip off a legitimate source ending from the input string NAME of