This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Restore set_fatal_function
- To: gcc-patches at gcc dot gnu dot org
- Subject: Restore set_fatal_function
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Tue, 15 Aug 00 17:35:34 EDT
I have restored this functionality. The checkin also adds blank lines
in front of a number of function in diagnostic.c where they were
missing: those hunks were omitted below.
Tue Aug 15 17:33:05 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* diagnostic.c (fatal_function): New variable.
(set_fatal_function): New function.
(fatal): Call it.
* diagnostic.h (set_fatal_function): New declaration.
*** diagnostic.c 2000/07/22 23:29:13 1.28
--- diagnostic.c 2000/08/15 20:34:44
*************** static int last_error_tick;
*** 128,132 ****
/* Called by report_error_function to print out function name.
! * Default may be overridden by language front-ends. */
void (*print_error_function) PARAMS ((const char *)) =
--- 128,132 ----
/* Called by report_error_function to print out function name.
! Default may be overridden by language front-ends. */
void (*print_error_function) PARAMS ((const char *)) =
*************** initialize_diagnostics ()
*** 154,157 ****
--- 154,158 ----
diagnostic_message_length_per_line = 0;
set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_ONCE);
+
/* Proceed to actual initialization. */
default_initialize_buffer (diagnostic_buffer);
*************** output_set_prefix (buffer, prefix)
*** 225,229 ****
}
! /* Free BUFFER's prefix, a previously malloc()'d string. */
void
--- 231,235 ----
}
! /* Free BUFFER's prefix, a previously malloc'd string. */
void
*************** output_format (buffer)
*** 574,577 ****
--- 595,599 ----
{
int long_integer = 0;
+
/* Ignore text. */
{
*************** output_format (buffer)
*** 582,585 ****
--- 604,608 ----
output_buffer_text_cursor (buffer) = p;
}
+
if (!*output_buffer_text_cursor (buffer))
break;
*************** output_format (buffer)
*** 671,679 ****
default:
! if (!lang_printer || !(*lang_printer) (buffer))
{
/* Hmmm. The front-end failed to install a format translator
but called us with an unrecognized format. Sorry. */
! abort();
}
}
--- 694,702 ----
default:
! if (! lang_printer || !(*lang_printer) (buffer))
{
/* Hmmm. The front-end failed to install a format translator
but called us with an unrecognized format. Sorry. */
! abort ();
}
}
*************** error VPARAMS ((const char *msgid, ...))
*** 1269,1273 ****
--- 1299,1315 ----
/* Report a fatal error at the current line number. Allow a front end to
intercept the message. */
+
+ static void (*fatal_function) PARAMS((const char *, va_list *));
+
+ /* Set the function to call when a fatal error occurs. */
+
void
+ set_fatal_function (f)
+ void (*f) PARAMS ((const char *, va_list *));
+ {
+ fatal_function = f;
+ }
+
+ void
fatal VPARAMS ((const char *msgid, ...))
{
*************** fatal VPARAMS ((const char *msgid, ...))
*** 1282,1285 ****
--- 1324,1330 ----
msgid = va_arg (ap, const char *);
#endif
+
+ if (fatal_function != 0)
+ (*fatal_function) (_(msgid), &ap);
report_diagnostic (msgid, &ap, input_filename, lineno, 0);
*** diagnostic.h 2000/07/18 08:40:32 1.8
--- diagnostic.h 2000/08/15 20:34:45
*************** extern output_buffer *diagnostic_buffer;
*** 102,105 ****
--- 102,107 ----
/* Prototypes */
+ void set_fatal_function PARAMS ((void (*) PARAMS ((const char *,
+ va_list *))));
void report_diagnostic PARAMS ((const char *, va_list *,
const char *, int, int));