diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-22 20:37:20 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-22 20:37:20 +0000 |
commit | c808d0268bcba04615e10fcf39b670f81811d9bd (patch) | |
tree | 5d1c57d7edd200e5b5467bf355348a54e5238af3 /gcc/cppfiles.c | |
parent | afe739a7ae845b6f7228350db57e0537547688fb (diff) | |
download | gcc-c808d0268bcba04615e10fcf39b670f81811d9bd.tar.gz |
* cpperror.c (print_location): Don't show _Pragma.
* cppfiles.c (_cpp_pop_file_buffer): Handle -include file pushing
and file change callback generation here.
(stack_include_file): Update use of cpp_push_buffer.
* cpphash.h (_cpp_pop_file_buffer): Update prototype.
(struct cpp_buffer): Remove type, pfile members.
* cppinit.c (cpp_handle_option): Use free_chain.
* cpplex.c (_cpp_lex_token): Don't do -include file pushing here.
(skip_escaped_newlines, get_effective_char, lex_percent): Take
a cpp_reader rather than a cpp_buffer.
(skip_escaped_newlines, get_effective_char, skip_block_comment,
skip_line_comment, parse_string, lex_percent, lex_dot,
_cpp_lex_token): Update accordingly.
* cpplib.c (_cpp_pop_buffer): Don't do file change callback
generation here.
(cpp_push_buffer): Update prototype.
(run_directive): Update use of cpp_push_buffer.
(_cpp_do__Pragma, cpp_define, cpp_define_builtin, cpp_undef,
handle_assertion): Update use of run_directive.
* cpplib.h (enum cpp_buffer_type): Remove.
(cpp_push_buffer): Update prototype.
* fix-header.c (read_scan_file): Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45112 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r-- | gcc/cppfiles.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index c8b28f94744..5b8f9076b39 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -317,7 +317,8 @@ stack_include_file (pfile, inc) inc->include_count++; /* Push a buffer. */ - fp = cpp_push_buffer (pfile, inc->buffer, inc->st.st_size, BUF_FILE, 0); + fp = cpp_push_buffer (pfile, inc->buffer, inc->st.st_size, + /* from_stage3 */ CPP_OPTION (pfile, preprocessed), 0); fp->inc = inc; fp->inc->refcnt++; @@ -720,14 +721,12 @@ _cpp_read_file (pfile, fname) } /* Do appropriate cleanup when a file buffer is popped off the input - stack. */ + stack. Push the next -include file, if any remain. */ void -_cpp_pop_file_buffer (pfile, buf) +_cpp_pop_file_buffer (pfile, inc) cpp_reader *pfile; - cpp_buffer *buf; + struct include_file *inc; { - struct include_file *inc = buf->inc; - /* Record the inclusion-preventing macro, which could be NULL meaning no controlling macro. */ if (pfile->mi_valid && inc->cmacro == NULL) @@ -739,6 +738,16 @@ _cpp_pop_file_buffer (pfile, buf) inc->refcnt--; if (inc->refcnt == 0 && DO_NOT_REREAD (inc)) purge_cache (inc); + + /* Don't generate a callback for popping the main file. */ + if (pfile->buffer) + { + _cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0); + + /* Finally, push the next -included file, if any. */ + if (!pfile->buffer->prev) + _cpp_push_next_buffer (pfile); + } } /* Returns the first place in the include chain to start searching for @@ -772,8 +781,7 @@ search_from (pfile, type) if (dlen) { /* We don't guarantee NAME is null-terminated. This saves - allocating and freeing memory, and duplicating it when faking - buffers in cpp_push_buffer. Drop a trailing '/'. */ + allocating and freeing memory. Drop a trailing '/'. */ buffer->dir.name = buffer->inc->name; if (dlen > 1) dlen--; |