diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-08-21 21:17:48 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-08-21 21:17:48 +0000 |
commit | 5993019d2058a2d4ff24b5990ff6d4ac9c8a3311 (patch) | |
tree | 2dfd14ccaad28936c874d7de1b8e61b3d1be6abd /gcc/line-map.c | |
parent | e5eba70ac7f7e76bbc784eee6191e7464694dba1 (diff) | |
download | gcc-5993019d2058a2d4ff24b5990ff6d4ac9c8a3311.zip gcc-5993019d2058a2d4ff24b5990ff6d4ac9c8a3311.tar.gz gcc-5993019d2058a2d4ff24b5990ff6d4ac9c8a3311.tar.bz2 |
cppfiles.c (stack_include_file): Don't handle -H here.
* cppfiles.c (stack_include_file): Don't handle -H here.
* cppinit.c (cpp_start_read): Set include tracing after
cpp_post_options and after stacking the main file.
* line-map.c (trace_include): New.
(init_line_maps, add_line_map): Update.
* line-map.h (struct line_maps): New member trace_includes.
From-SVN: r45084
Diffstat (limited to 'gcc/line-map.c')
-rw-r--r-- | gcc/line-map.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/line-map.c b/gcc/line-map.c index d1df557..b2809b1 100644 --- a/gcc/line-map.c +++ b/gcc/line-map.c @@ -25,6 +25,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "line-map.h" #include "intl.h" +static void trace_include + PARAMS ((const struct line_maps *, const struct line_map *)); + /* Initialize a line map set. */ void @@ -35,6 +38,7 @@ init_line_maps (set) set->allocated = 0; set->used = 0; set->last_listed = -1; + set->trace_includes = false; } /* Free a line map set. */ @@ -136,8 +140,11 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line) map->included_from = map[-1].included_from; else if (reason == LC_LEAVE) map->included_from = INCLUDED_FROM (set, map - 1)->included_from; - set->used++; + + if (reason == LC_ENTER && set->trace_includes) + trace_include (set, map); + return map; } @@ -207,3 +214,17 @@ print_containing_files (set, map) fputs (":\n", stderr); } + +/* Print an include trace, for e.g. the -H option of the preprocessor. */ + +static void +trace_include (set, map) + const struct line_maps *set; + const struct line_map *map; +{ + const struct line_map *m; + + for (m = map; !MAIN_FILE_P (m); m = INCLUDED_FROM (set, m)) + putc ('.', stderr); + fprintf (stderr, " %s\n", map->to_file); +} |