aboutsummaryrefslogtreecommitdiff
path: root/gcc/line-map.h
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-08-06 21:07:41 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-08-06 21:07:41 +0000
commitfde84349bec539f5e49273d4e05465b52c6aa7e6 (patch)
tree31a1005e7788f3f63227ac0f3097f1ff9111a46e /gcc/line-map.h
parentdf4556a3aaebc1b9e4da76be5ad806c431653eb8 (diff)
downloadgcc-fde84349bec539f5e49273d4e05465b52c6aa7e6.zip
gcc-fde84349bec539f5e49273d4e05465b52c6aa7e6.tar.gz
gcc-fde84349bec539f5e49273d4e05465b52c6aa7e6.tar.bz2
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
Diffstat (limited to 'gcc/line-map.h')
-rw-r--r--gcc/line-map.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/line-map.h b/gcc/line-map.h
index bbc6caa..d5705c7 100644
--- a/gcc/line-map.h
+++ b/gcc/line-map.h
@@ -42,6 +42,11 @@ struct line_maps
struct line_map *maps;
unsigned int allocated;
unsigned int used;
+
+ /* The most recently listed include stack, if any, starts with
+ LAST_LISTED as the topmost including file. -1 indicates nothing
+ has been listed yet. */
+ int last_listed;
};
/* Reason for adding a line change with add_line_map (). LC_ENTER is
@@ -74,6 +79,12 @@ extern struct line_map *add_line_map
extern struct line_map *lookup_line
PARAMS ((struct line_maps *, unsigned int));
+/* Print the file names and line numbers of the #include commands
+ which led to the map MAP, if any, to stderr. Nothing is output if
+ the most recently listed stack is the same as the current one. */
+extern void print_containing_files
+ PARAMS ((struct line_maps *, struct line_map *));
+
/* Converts a map and logical line to source line. */
#define SOURCE_LINE(MAP, LINE) ((LINE) + (MAP)->to_line - (MAP)->from_line)
@@ -81,6 +92,9 @@ extern struct line_map *lookup_line
of the #include, or other directive, that caused a map change. */
#define LAST_SOURCE_LINE(MAP) SOURCE_LINE ((MAP), (MAP)[1].from_line - 1)
+/* Returns the map a given map was included from. */
+#define INCLUDED_FROM(SET, MAP) (&(SET)->maps[(MAP)->included_from])
+
/* Non-zero if the map is at the bottom of the include stack. */
#define MAIN_FILE_P(MAP) ((MAP)->included_from < 0)