summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-23 08:51:10 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-23 08:51:10 +0000
commit9d7131bf5966e9d4bbaa1c082ed418c5b263b62d (patch)
treedddeb957b58b9b0f7e1d3254194afaf71ebeb8f6 /gcc/diagnostic.c
parentc09566dff0f9db4456b2d85ef13acf0c992fbeb5 (diff)
downloadgcc-9d7131bf5966e9d4bbaa1c082ed418c5b263b62d.tar.gz
* diagnostic-core.h (internal_error_no_backtrace): New prototype.
* diagnostic.def (DK_ICE_NOBT): New kind. * diagnostic.c (diagnostic_action_after_output): Handle DK_ICE_NOBT like DK_ICE, but never print backtrace. (diagnostic_report_diagnostic): Handle DK_ICE_NOBT like DK_ICE. (internal_error_no_backtrace): New function. * gcc.c (execute): Use internal_error_no_backtrace instead of internal_error. fortran/ * gfc-diagnostic.def (DK_ICE_NOBT): New kind. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220030 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 6b4da23e7b9..33eed3ec6f5 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -518,9 +518,11 @@ diagnostic_action_after_output (diagnostic_context *context,
break;
case DK_ICE:
+ case DK_ICE_NOBT:
{
- struct backtrace_state *state =
- backtrace_create_state (NULL, 0, bt_err_callback, NULL);
+ struct backtrace_state *state = NULL;
+ if (diag_kind == DK_ICE)
+ state = backtrace_create_state (NULL, 0, bt_err_callback, NULL);
int count = 0;
if (state != NULL)
backtrace_full (state, 2, bt_callback, bt_err_callback,
@@ -739,7 +741,8 @@ diagnostic_report_diagnostic (diagnostic_context *context,
/* If we're reporting an ICE in the middle of some other error,
try to flush out the previous error, then let this one
through. Don't do this more than once. */
- if (diagnostic->kind == DK_ICE && context->lock == 1)
+ if ((diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)
+ && context->lock == 1)
pp_newline_and_flush (context->printer);
else
error_recursion (context);
@@ -812,7 +815,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
context->lock++;
- if (diagnostic->kind == DK_ICE)
+ if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)
{
#ifndef ENABLE_CHECKING
/* When not checking, ICEs are converted to fatal errors when an
@@ -1239,6 +1242,23 @@ internal_error (const char *gmsgid, ...)
gcc_unreachable ();
}
+
+/* Like internal_error, but no backtrace will be printed. Used when
+ the internal error does not happen at the current location, but happened
+ somewhere else. */
+void
+internal_error_no_backtrace (const char *gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ICE_NOBT);
+ report_diagnostic (&diagnostic);
+ va_end (ap);
+
+ gcc_unreachable ();
+}
/* Special case error functions. Most are implemented in terms of the
above, or should be. */