From 966e8f4d3fa971039cad79e25de0f0cb385a9368 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 29 Feb 2008 20:09:05 +0000 Subject: toplev.c (input_file_stack, [...]): Remove. gcc * toplev.c (input_file_stack, input_file_stack_tick, fs_p, input_file_stack_history, input_file_stack_restored): Remove. (push_srcloc, pop_srcloc, restore_input_file_stack): Likewise. * input.h (struct file_stack): Remove. (push_srcloc, pop_srcloc, restore_input_file_stack): Likewise. (input_file_stack, input_file_stack_tick, INPUT_FILE_STACK_BITS): Likewise. * diagnostic.h (struct diagnostic_context) : Change type. (diagnostic_last_module_changed): Add 'map' argument. (diagnostic_set_last_function): Likewise. * diagnostic.c (undiagnostic_report_current_module): Iterate using line map, not input_file_stack. * c-lex.c (fe_file_change): Don't use push_srcloc or pop_srcloc. gcc/cp * parser.c (struct cp_token) : Remove. (cp_lexer_get_preprocessor_token): Update. (cp_lexer_set_source_position_from_token): Don't call restore_input_file_stack. * lex.c (cxx_init): Don't use push_srcloc or pop_srcloc. gcc/testsuite * g++.dg/warn/pragma-system_header2.C: Ignore "included from" line. From-SVN: r132775 --- gcc/diagnostic.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'gcc/diagnostic.c') diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 05f153387d7..bc4e051b8b5 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -269,7 +269,7 @@ diagnostic_report_current_function (diagnostic_context *context, void diagnostic_report_current_module (diagnostic_context *context) { - struct file_stack *p; + const struct line_map *map; if (pp_needs_newline (context->printer)) { @@ -277,23 +277,29 @@ diagnostic_report_current_module (diagnostic_context *context) pp_needs_newline (context->printer) = false; } - p = input_file_stack; - if (p && diagnostic_last_module_changed (context)) + if (input_location <= BUILTINS_LOCATION) + return; + + map = linemap_lookup (line_table, input_location); + if (map && diagnostic_last_module_changed (context, map)) { - expanded_location xloc = expand_location (p->location); - pp_verbatim (context->printer, - "In file included from %s:%d", - xloc.file, xloc.line); - while ((p = p->next) != NULL) + diagnostic_set_last_module (context, map); + if (! MAIN_FILE_P (map)) { - xloc = expand_location (p->location); + map = INCLUDED_FROM (line_table, map); pp_verbatim (context->printer, - ",\n from %s:%d", - xloc.file, xloc.line); + "In file included from %s:%d", + map->to_file, LAST_SOURCE_LINE (map)); + while (! MAIN_FILE_P (map)) + { + map = INCLUDED_FROM (line_table, map); + pp_verbatim (context->printer, + ",\n from %s:%d", + map->to_file, LAST_SOURCE_LINE (map)); + } + pp_verbatim (context->printer, ":"); + pp_newline (context->printer); } - pp_verbatim (context->printer, ":"); - diagnostic_set_last_module (context); - pp_newline (context->printer); } } -- cgit v1.2.1