aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.cc
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2023-04-07 22:04:54 +0200
committerThomas Schwinge <thomas_schwinge@mentor.com>2023-04-07 22:04:54 +0200
commitb1d131f8941cd30ee7904698e7d3bcc20686b61c (patch)
tree3dcb318ea104daa2fcc771c5e3de080414c45730 /gcc/diagnostic.cc
parent353f5e8f00a2f897d2974f07d27dd10f79666889 (diff)
parent939fb3fffebf7be2638ddef25dbe1c15f2aaa9d6 (diff)
downloadgcc-b1d131f8941cd30ee7904698e7d3bcc20686b61c.zip
gcc-b1d131f8941cd30ee7904698e7d3bcc20686b61c.tar.gz
gcc-b1d131f8941cd30ee7904698e7d3bcc20686b61c.tar.bz2
Merge commit '939fb3fffebf7be2638ddef25dbe1c15f2aaa9d6' into HEAD
Diffstat (limited to 'gcc/diagnostic.cc')
-rw-r--r--gcc/diagnostic.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index bc077bbb..7c2f9c4 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -241,6 +241,7 @@ diagnostic_initialize (diagnostic_context *context, int n_opts)
context->begin_group_cb = NULL;
context->end_group_cb = NULL;
context->final_cb = default_diagnostic_final_cb;
+ context->ice_handler_cb = NULL;
context->includes_seen = NULL;
context->m_client_data_hooks = NULL;
}
@@ -665,6 +666,18 @@ diagnostic_action_after_output (diagnostic_context *context,
case DK_ICE:
case DK_ICE_NOBT:
{
+ /* Optional callback for attempting to handle ICEs gracefully. */
+ if (void (*ice_handler_cb) (diagnostic_context *)
+ = context->ice_handler_cb)
+ {
+ /* Clear the callback, to avoid potentially re-entering
+ the routine if there's a crash within the handler. */
+ context->ice_handler_cb = NULL;
+ ice_handler_cb (context);
+ }
+ /* The context might have had diagnostic_finish called on
+ it at this point. */
+
struct backtrace_state *state = NULL;
if (diag_kind == DK_ICE)
state = backtrace_create_state (NULL, 0, bt_err_callback, NULL);