From ee3400e881ef5870dd6b1d274dfcd09c73828a1a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 15 Nov 2000 10:50:51 -0500 Subject: [PATCH] diagnostic.c (finish_abort): New fn. * 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 | 29 ++++++++++++++++++----------- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck2.c | 3 +++ gcc/diagnostic.c | 31 ++++++++++++++++++++++--------- gcc/diagnostic.h | 1 + gcc/toplev.c | 5 ++--- 6 files changed, 51 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 69ad2e9..7f461b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2000-11-15 Jason Merrill + + * 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 * tree.c (build_type_no_quals): New function. @@ -179,17 +186,17 @@ Tue Nov 14 12:34:56 2000 Richard Kenner 2000-11-13 Neil Booth - * 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 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 881ad2b..c5a369c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-11-15 Jason Merrill + + * typeck2.c (friendly_abort): Uncount the error before handing + off to fancy_abort. + 2000-11-15 Nathan Sidwell * typeck.c (lookup_anon_field): Cope with qv qualifiers. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 9141c6f..b030a05 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -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); } diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 26ffa02..036b1ce 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -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), diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 6d693fc..5abae7b 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -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__ */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 1f46f35..95955fb 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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 -- 2.7.4