void linemap_print_containing_files (struct line_maps *set, const struct line_map *map) { if (MAIN_FILE_P (map) || set->last_listed == map->included_from) return; set->last_listed = map->included_from; map = INCLUDED_FROM (set, map); fprintf (stderr, _("In file included from %s:%u"), map->to_file, LAST_SOURCE_LINE (map)); while (! MAIN_FILE_P (map)) { map = INCLUDED_FROM (set, map); /* Translators note: this message is used in conjunction with "In file included from %s:%ld" and some other tricks. We want something like this: | In file included from sys/select.h:123, | from sys/types.h:234, | from userfile.c:31: | bits/select.h:45: <error message here> with all the "from"s lined up. The trailing comma is at the beginning of this message, and the trailing colon is not translated. */ fprintf (stderr, _(",\n from %s:%u"), map->to_file, LAST_SOURCE_LINE (map)); } fputs (":\n", stderr); }
void fe_file_change (const struct line_map *new_map) { if (new_map == NULL) return; if (new_map->reason == LC_ENTER) { /* Don't stack the main buffer on the input stack; we already did in compile_file. */ if (!MAIN_FILE_P (new_map)) { #ifdef USE_MAPPED_LOCATION int included_at = LAST_SOURCE_LINE_LOCATION (new_map - 1); input_location = included_at; push_srcloc (new_map->start_location); #else int included_at = LAST_SOURCE_LINE (new_map - 1); input_line = included_at; push_srcloc (new_map->to_file, 1); #endif (*debug_hooks->start_source_file) (included_at, new_map->to_file); #ifndef NO_IMPLICIT_EXTERN_C if (c_header_level) ++c_header_level; else if (new_map->sysp == 2) { c_header_level = 1; ++pending_lang_change; } #endif } } else if (new_map->reason == LC_LEAVE) { #ifndef NO_IMPLICIT_EXTERN_C if (c_header_level && --c_header_level == 0) { if (new_map->sysp == 2) warning (0, "badly nested C headers from preprocessor"); --pending_lang_change; } #endif pop_srcloc (); (*debug_hooks->end_source_file) (new_map->to_line); } update_header_times (new_map->to_file); in_system_header = new_map->sysp != 0; #ifdef USE_MAPPED_LOCATION input_location = new_map->start_location; #else input_filename = new_map->to_file; input_line = new_map->to_line; #endif }
void diagnostic_report_current_module (diagnostic_context *context, location_t where) { const struct line_map *map = NULL; if (pp_needs_newline (context->printer)) { pp_newline (context->printer); pp_needs_newline (context->printer) = false; } if (where <= BUILTINS_LOCATION) return; linemap_resolve_location (line_table, where, LRK_MACRO_DEFINITION_LOCATION, &map); if (map && diagnostic_last_module_changed (context, map)) { diagnostic_set_last_module (context, map); if (! MAIN_FILE_P (map)) { map = INCLUDED_FROM (line_table, map); if (context->show_column) pp_verbatim (context->printer, "In file included from %s:%d:%d", LINEMAP_FILE (map), LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map)); else pp_verbatim (context->printer, "In file included from %s:%d", LINEMAP_FILE (map), LAST_SOURCE_LINE (map)); while (! MAIN_FILE_P (map)) { map = INCLUDED_FROM (line_table, map); pp_verbatim (context->printer, ",\n from %s:%d", LINEMAP_FILE (map), LAST_SOURCE_LINE (map)); } pp_verbatim (context->printer, ":"); pp_newline (context->printer); } } }
void diagnostic_report_current_module (diagnostic_context *context) { const struct line_map *map; if (pp_needs_newline (context->printer)) { pp_newline (context->printer); pp_needs_newline (context->printer) = false; } if (input_location <= BUILTINS_LOCATION) return; map = linemap_lookup (line_table, input_location); if (map && diagnostic_last_module_changed (context, map)) { diagnostic_set_last_module (context, map); if (! MAIN_FILE_P (map)) { map = INCLUDED_FROM (line_table, map); if (flag_show_column) pp_verbatim (context->printer, "In file included from %s:%d:%d", map->to_file, LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map)); else pp_verbatim (context->printer, "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); } } }