diff options
author | Tom Tromey <tromey@redhat.com> | 2008-02-29 20:09:05 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2008-02-29 20:09:05 +0000 |
commit | 966e8f4d3fa971039cad79e25de0f0cb385a9368 (patch) | |
tree | 11ac9314a803ee4f351c76ac29b94a265faace5a /gcc/diagnostic.c | |
parent | 3cbe0ba6aab8e6310613a7cfc1d153840f210cf7 (diff) | |
download | gcc-966e8f4d3fa971039cad79e25de0f0cb385a9368.tar.gz |
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) <last_module>: 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) <input_file_stack_index>: 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
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r-- | gcc/diagnostic.c | 34 |
1 files changed, 20 insertions, 14 deletions
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); } } |