summaryrefslogtreecommitdiffstats
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-05 23:42:43 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-05 23:42:43 +0000
commitc4a0fee9ea0630bd19fe39580e78427126501aae (patch)
treef75c0eae70e97a88004eb221f90aa6ae6175ab77 /gcc/cpplib.c
parent39b4544721a42184a6259f64d2197630d71d4744 (diff)
downloadppe42-gcc-c4a0fee9ea0630bd19fe39580e78427126501aae.tar.gz
ppe42-gcc-c4a0fee9ea0630bd19fe39580e78427126501aae.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38057 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 197faaf3c18..26c2ece60b7 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;
}
OpenPOWER on IntegriCloud