From eb1f4d9d2804a8f244a06bff2d22d62906cccbb8 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Mon, 18 Dec 2000 19:00:26 +0000 Subject: 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 --- gcc/cppfiles.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'gcc/cppfiles.c') 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. -- cgit v1.1