diff options
author | Neil Booth <neilb@earthling.net> | 2000-12-05 23:42:43 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2000-12-05 23:42:43 +0000 |
commit | 3cf3593fad06d6fb27f5e8ef3715c41fad1553b8 (patch) | |
tree | f75c0eae70e97a88004eb221f90aa6ae6175ab77 /gcc/cpplib.c | |
parent | d53c4221afa7f4a00b7200c6d9023e1c6c5c2769 (diff) | |
download | gcc-3cf3593fad06d6fb27f5e8ef3715c41fad1553b8.zip gcc-3cf3593fad06d6fb27f5e8ef3715c41fad1553b8.tar.gz gcc-3cf3593fad06d6fb27f5e8ef3715c41fad1553b8.tar.bz2 |
cppfiles.c (stack_include_file): Push zero-length buffers in case of failure.
* cppfiles.c (stack_include_file): Push zero-length buffers
in case of failure. Return void, as we don't fail any more.
(read_include_file): Check for files we shouldn't re-read.
Don't return an error code; errors are implied by marking the
file NEVER_REREAD.
(_cpp_execute_include): Move the recursion and in-macro checks
here. Update for stack_include_file not failing.
* cpplib.c (cpp_push_buffer): Always succeed, since
_cpp_execute_include performs the recursion check. Tidy up.
* cpplib.h (cpp_push_buffer): Update prototype.
From-SVN: r38057
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 197faaf..26c2ece 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -1731,42 +1731,34 @@ handle_assertion (pfile, str, type) run_directive (pfile, type, str, count, 0); } -/* Allocate a new cpp_buffer for PFILE, and push it on the input - buffer stack. If BUFFER != NULL, then use the LENGTH characters in - BUFFER as the new input buffer. Return the new buffer, or NULL on - failure. */ +/* Push a new buffer on the buffer stack. Buffer can be NULL, but + then LEN should be 0. Returns the new buffer; it doesn't fail. */ cpp_buffer * -cpp_push_buffer (pfile, buffer, length) +cpp_push_buffer (pfile, buffer, len) cpp_reader *pfile; const U_CHAR *buffer; - long length; + size_t len; { - cpp_buffer *buf = CPP_BUFFER (pfile); - cpp_buffer *new; - if (++pfile->buffer_stack_depth == CPP_STACK_MAX) - { - cpp_fatal (pfile, "#include nested too deeply"); - return NULL; - } + cpp_buffer *new = xobnew (pfile->buffer_ob, cpp_buffer); - new = xobnew (pfile->buffer_ob, cpp_buffer); /* Clears, amongst other things, if_stack and mi_cmacro. */ memset (new, 0, sizeof (cpp_buffer)); - - pfile->lexer_pos.output_line = 1; new->line_base = new->buf = new->cur = buffer; - new->rlimit = buffer + length; - new->prev = buf; + new->rlimit = buffer + len; + new->prev = pfile->buffer; new->pfile = pfile; /* Preprocessed files don't do trigraph and escaped newline processing. */ new->from_stage3 = CPP_OPTION (pfile, preprocessed); /* No read ahead or extra char initially. */ new->read_ahead = EOF; new->extra_char = EOF; + pfile->state.next_bol = 1; + pfile->buffer_stack_depth++; + pfile->lexer_pos.output_line = 1; - CPP_BUFFER (pfile) = new; + pfile->buffer = new; return new; } |