diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-21 23:05:12 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-21 23:05:12 +0000 |
commit | 4087823d086e903795ecaff665e6ff3afb58c3dd (patch) | |
tree | e9c81016bacfbc22e38372b7b5b54d1c58bf8dc2 /gcc/line-map.c | |
parent | 438ac94c9b141e04a7b2512298120f5724b521ed (diff) | |
download | gcc-4087823d086e903795ecaff665e6ff3afb58c3dd.tar.gz |
* cppfiles.c (stack_include_file): line-map.c now handles include
depth.
(handle_missing_handler): Similarly.
(_cpp_execute_include): Similarly.
(_cpp_pop_file_buffer): Similarly.
* cpphash.h (struct cpp_reader): Remove system_include_depth,
buffer_stack_depth and include_depth.
* cpplib.c (do_include_common): line-map.c now handles include depth.
(cpp_push_buffer): Similarly.
(_cpp_pop_buffer): Similarly.
* cppmacro.c (builtin_macro): Update.
* line-map.c (init_line_maps): Set depth.
(add_line_map): Increment "used" earlier. Update and use the
include depth.
(trace_include): Use the include depth.
* line-map.h (struct line_maps): New member depth.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45085 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/line-map.c')
-rw-r--r-- | gcc/line-map.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gcc/line-map.c b/gcc/line-map.c index b2809b1510c..a0f3ee50bc0 100644 --- a/gcc/line-map.c +++ b/gcc/line-map.c @@ -39,6 +39,7 @@ init_line_maps (set) set->used = 0; set->last_listed = -1; set->trace_includes = false; + set->depth = 0; } /* Free a line map set. */ @@ -90,11 +91,11 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line) xrealloc (set->maps, set->allocated * sizeof (struct line_map)); } - map = &set->maps[set->used]; + map = &set->maps[set->used++]; /* If we don't keep our line maps consistent, we can easily segfault. Don't rely on the client to do it for us. */ - if (set->used == 0) + if (set->depth == 0) reason = LC_ENTER; else if (reason == LC_LEAVE) { @@ -135,15 +136,19 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line) map->to_line = to_line; if (reason == LC_ENTER) - map->included_from = set->used - 1; + { + set->depth++; + map->included_from = set->used - 2; + if (set->trace_includes) + trace_include (set, map); + } else if (reason == LC_RENAME) 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); + { + set->depth--; + map->included_from = INCLUDED_FROM (set, map - 1)->included_from; + } return map; } @@ -222,9 +227,9 @@ trace_include (set, map) const struct line_maps *set; const struct line_map *map; { - const struct line_map *m; + unsigned int i = set->depth; - for (m = map; !MAIN_FILE_P (m); m = INCLUDED_FROM (set, m)) + while (--i) putc ('.', stderr); fprintf (stderr, " %s\n", map->to_file); } |