summaryrefslogtreecommitdiff
path: root/gcc/cpperror.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-06 21:07:41 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-06 21:07:41 +0000
commitbd507c05c4b80c10844cdacac547bca837686b52 (patch)
tree31a1005e7788f3f63227ac0f3097f1ff9111a46e /gcc/cpperror.c
parentc6e2ff2063e0087a87cff9af0a8809c350318572 (diff)
downloadgcc-bd507c05c4b80c10844cdacac547bca837686b52.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44670 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpperror.c')
-rw-r--r--gcc/cpperror.c52
1 files changed, 1 insertions, 51 deletions
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
index 4ed4de6273a..167ea9d46a5 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: <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);
-}
-
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)