From fde84349bec539f5e49273d4e05465b52c6aa7e6 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Mon, 6 Aug 2001 21:07:41 +0000 Subject: cpperror.c (print_containing_files): Moved to line-map.c. * cpperror.c (print_containing_files): Moved to line-map.c. (print_location): line-map.c handles re-listing or otherwise. * cpphash.h (struct lexer_state): Remove next_bol. (struct cpp_buffer): Remove include_stack_listed. * cpplib.c (do_line, cpp_push_buffer, _cpp_pop_buffer): Remove faked buffer handling. (_cpp_do_file_change): Tweak. * cpplib.h (enum cpp_buffer_type): Remove BUF_FAKE. * cppmain.c (struct printer): Remove filename. (print_line, cb_file_change): Update accordingly. * line-map.c: Include intl.h. (init_line_maps): Initialize last_listed. (free_line_maps): Sanity check, warn if ENABLED_CHECKING. (add_line_map): Sanity check inputs, warn if ENABLED_CHECKING. (print_containing_files): New. * line-map.h (struct line_maps): New member last_listed. (print_containing_files, INCLUDED_FROM): New. * Makefile.in: Update. * po/POTFILES.in: Add line-map.c. From-SVN: r44670 --- gcc/cpperror.c | 52 +--------------------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) (limited to 'gcc/cpperror.c') diff --git a/gcc/cpperror.c b/gcc/cpperror.c index 4ed4de6..167ea9d 100644 --- a/gcc/cpperror.c +++ b/gcc/cpperror.c @@ -29,8 +29,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "cpphash.h" #include "intl.h" -static void print_containing_files PARAMS ((struct line_map *, - struct line_map *)); static void print_location PARAMS ((cpp_reader *, const char *, const cpp_lexer_pos *)); @@ -40,49 +38,6 @@ static void print_location PARAMS ((cpp_reader *, #define v_message(msgid, ap) \ do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0) -/* Print the file names and line numbers of the #include - commands which led to the current file. */ -static void -print_containing_files (map_array, map) - struct line_map *map_array; - struct line_map *map; -{ - int first = 1; - - for (;;) - { - if (MAIN_FILE_P (map)) - break; - map = &map_array[map->included_from]; - - if (first) - { - first = 0; - /* The current line in each outer source file is now the - same as the line of the #include. */ - fprintf (stderr, _("In file included from %s:%u"), - map->to_file, LAST_SOURCE_LINE (map)); - } - else - /* 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: - - 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); -} - static void print_location (pfile, filename, pos) cpp_reader *pfile; @@ -122,12 +77,7 @@ print_location (pfile, filename, pos) if (col == 0) col = 1; - /* Don't repeat the include stack unnecessarily. */ - if (buffer->prev && ! buffer->include_stack_listed) - { - buffer->include_stack_listed = 1; - print_containing_files (pfile->line_maps.maps, map); - } + print_containing_files (&pfile->line_maps, map); } if (filename == 0) -- cgit v1.1