aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2000-12-18 19:00:26 +0000
committerNeil Booth <neil@gcc.gnu.org>2000-12-18 19:00:26 +0000
commiteb1f4d9d2804a8f244a06bff2d22d62906cccbb8 (patch)
treedc29c41d4ea8d368485a05613f91c17d4bec16ea /gcc/cppfiles.c
parente2187d3b5278e31a321fae25879d9044248d2287 (diff)
downloadgcc-eb1f4d9d2804a8f244a06bff2d22d62906cccbb8.zip
gcc-eb1f4d9d2804a8f244a06bff2d22d62906cccbb8.tar.gz
gcc-eb1f4d9d2804a8f244a06bff2d22d62906cccbb8.tar.bz2
c-lex.c: s/change_file/file_change.
* c-lex.c: s/change_file/file_change. * cpplib.h: Similarly. * cppmain.c: Similarly. * fix-header.c: Similarly. * cppfiles.c (stack_include_file): Pass the buffer location and size to cpp_push_buffer. Generate the file_change callback, so that sysp is already set. * cpphash.h: Add _cpp_do_file_change. * cpplib.c (do_line): Set buffer->sysp directly. Generate the file_change callback after setting sysp. (_cpp_do_file_change): Handle FC_ENTER and the FC_RENAME exception here. (cpp_push_buffer): Don't generate a callback. Clear sysp. (cpp_pop_buffer): Clean up logic. From-SVN: r38357
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 96ce7e4..ddf2e80 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -245,21 +245,19 @@ stack_include_file (pfile, inc)
cpp_reader *pfile;
struct include_file *inc;
{
+ size_t len = 0;
cpp_buffer *fp;
/* Not in cache? */
if (! inc->buffer)
read_include_file (pfile, inc);
- /* Push a null buffer. */
- fp = cpp_push_buffer (pfile, NULL, 0, BUF_FILE, inc->name);
- fp->inc = inc;
- fp->buf = inc->buffer;
- fp->rlimit = fp->buf;
if (! DO_NOT_REREAD (inc))
- fp->rlimit += inc->st.st_size;
- fp->cur = fp->buf;
- fp->line_base = fp->buf;
+ len = inc->st.st_size;
+
+ /* Push a buffer. */
+ fp = cpp_push_buffer (pfile, inc->buffer, len, BUF_FILE, inc->name);
+ fp->inc = inc;
fp->inc->refcnt++;
if (inc->foundhere)
fp->sysp = inc->foundhere->sysp;
@@ -273,6 +271,11 @@ stack_include_file (pfile, inc)
pfile->mi_state = MI_OUTSIDE;
pfile->mi_cmacro = 0;
pfile->include_depth++;
+
+ /* Generate the call back. */
+ fp->lineno = 0;
+ _cpp_do_file_change (pfile, FC_ENTER, 0, 0);
+ fp->lineno = 1;
}
/* Read the file referenced by INC into the file cache.