This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Different language frontends and fancy_abort()
- To: Peter Gerwinski <peter at gerwinski dot de>
- Subject: Re: Different language frontends and fancy_abort()
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Date: Tue, 2 Jan 2001 18:01:50 +1100
- Cc: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <20010102034850.A10663@esmeralda.gerwinski.de>
On 02-Jan-2001, Peter Gerwinski <peter@gerwinski.de> wrote:
> when a bug in the Pascal frontend triggers `fancy_abort()', GCC says:
>
> filename.pas:1375: Internal compiler error in foo, at bar.c:34
> Please submit a full bug report.
> See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>
> I would prefer to have bug reports for the Pascal frontend directed
> to another address instead. A mechanism to modify that string would
> be nice here.
I agree. I want this for the Mercury front-end too.
Here's a patch.
----------
2001-01-02 Fergus Henderson <fjh@cs.mu.oz.au>
* diagnostic.c (lang_handle_ICE): New.
(finish_abort): Call it.
* diagnostic.h (lang_handle_ICE): Declare it.
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.44
diff -u -d -c -p -r1.44 diagnostic.c
*** diagnostic.c 2000/11/17 06:05:14 1.44
--- diagnostic.c 2001/01/02 06:57:53
*************** extern int errorcount;
*** 115,120 ****
--- 115,124 ----
/* Front-end specific tree formatter, if non-NULL. */
printer_fn lang_printer = NULL;
+ /* Front-end specific internal compiler error handler, if non-NULL. */
+ void (*lang_handle_ICE) PARAMS ((void)) = NULL;
+
+
/* This must be large enough to hold any printed integer or
floating-point value. */
static char digit_buffer[128];
*************** finish_abort ()
*** 1687,1692 ****
--- 1691,1698 ----
{
if (errorcount > 1 || sorrycount > 0)
fprintf (stderr, "confused by earlier errors, bailing out\n");
+ else if (lang_handle_ICE)
+ (*lang_handle_ICE) ();
else
fprintf (stderr, "\
Please submit a full bug report.\n\
Index: diagnostic.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.h,v
retrieving revision 1.18
diff -u -d -c -p -r1.18 diagnostic.h
*** diagnostic.h 2000/11/15 15:50:49 1.18
--- diagnostic.h 2001/01/02 06:57:53
*************** extern printer_fn lang_printer;
*** 156,161 ****
--- 156,167 ----
extern diagnostic_starter_fn lang_diagnostic_starter;
extern diagnostic_finalizer_fn lang_diagnostic_finalizer;
+ /* If non-NULL, this variable contains a function to call
+ after an internal compiler error is encountered.
+ Normally the function should print a message to instruct
+ users on how to report bugs. */
+ extern void (*lang_handle_ICE) PARAMS ((void));
+
extern int diagnostic_message_length_per_line;
/* This output buffer is used by front-ends that directly output
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.