summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-27 07:24:58 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-27 07:24:58 +0000
commitb8c23db329da6afaebde201237f25c583ba61885 (patch)
treeda9ad83a363c4d770588541c6c1fc6b8fc3e0b7a /gcc/diagnostic.c
parent8fdca00ada80224bbb584a12e7c5ca8ee333b905 (diff)
downloadgcc-b8c23db329da6afaebde201237f25c583ba61885.tar.gz
* builtins.c (expand_builtin, expand_builtin_object_size,
expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128830 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index c712608d73b..6bbfe9a36e7 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -261,10 +261,11 @@ diagnostic_action_after_output (diagnostic_context *context,
/* Prints out, if necessary, the name of the current function
that caused an error. Called from all error and warning functions. */
void
-diagnostic_report_current_function (diagnostic_context *context)
+diagnostic_report_current_function (diagnostic_context *context,
+ diagnostic_info *diagnostic)
{
diagnostic_report_current_module (context);
- lang_hooks.print_error_function (context, input_filename);
+ lang_hooks.print_error_function (context, input_filename, diagnostic);
}
void
@@ -302,7 +303,7 @@ static void
default_diagnostic_starter (diagnostic_context *context,
diagnostic_info *diagnostic)
{
- diagnostic_report_current_function (context);
+ diagnostic_report_current_function (context, diagnostic);
pp_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
}
@@ -414,6 +415,8 @@ diagnostic_report_diagnostic (diagnostic_context *context,
" [", cl_options[diagnostic->option_index].opt_text, "]", NULL));
diagnostic->message.locus = &diagnostic->location;
+ diagnostic->message.abstract_origin = &diagnostic->abstract_origin;
+ diagnostic->abstract_origin = NULL;
pp_format (context->printer, &diagnostic->message);
(*diagnostic_starter (context)) (context, diagnostic);
pp_output_formatted_text (context->printer);
@@ -421,6 +424,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
pp_flush (context->printer);
diagnostic_action_after_output (context, diagnostic);
diagnostic->message.format_spec = saved_format_spec;
+ diagnostic->abstract_origin = NULL;
}
context->lock--;
@@ -472,6 +476,7 @@ verbatim (const char *gmsgid, ...)
text.args_ptr = &ap;
text.format_spec = _(gmsgid);
text.locus = NULL;
+ text.abstract_origin = NULL;
pp_format_verbatim (global_dc->printer, &text);
pp_flush (global_dc->printer);
va_end (ap);