aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplex.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-07-05 05:33:57 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-07-05 05:33:57 +0000
commitc71f835b2549f6b787732b5e326c5c23dbb1f66b (patch)
tree0faabdcd2aa742b82e58d484b96722dd2b861e6e /gcc/cpplex.c
parent1bbee75bcc0d3948fb1e55da6a3547cddeb000a0 (diff)
downloadgcc-c71f835b2549f6b787732b5e326c5c23dbb1f66b.zip
gcc-c71f835b2549f6b787732b5e326c5c23dbb1f66b.tar.gz
gcc-c71f835b2549f6b787732b5e326c5c23dbb1f66b.tar.bz2
cpplex.c: Don't include sys/mman.h.
toplevel: * cpplex.c: Don't include sys/mman.h. (cpp_push_buffer, cpp_pop_buffer): Moved to cpplib.c. * cpplib.c: Include sys/mman.h and obstack.h. (cpp_push_buffer): Moved from cpplex.c; allocate buffers on an obstack. (cpp_pop_buffer): Moved from cpplex.c; free buffers from an obstack. (_cpp_unwind_if_stack): Now static, unwind_if_stack. Don't bother freeing if stack entries (they will be freed with their buffer). (do_endif): Free if stack entries from the buffer obstack. (push_conditional): Allocate if stack entries from the buffer obstack. (find_answer): Rename to _cpp_find_answer. (do_assert, do_unassert): Update. * cpphash.h: Update prototypes. (xobnew): New convenience macro. * cpplib.h (struct cpp_reader): Add hash_ob and buffer_ob fields. Update comments. (struct cpp_hashnode): Remove disabled field. * cppinit.c: Don't include hashtab.h or splay-tree.h. (report_missing_guard): Moved to cppfiles.c. (cpp_reader_init): Call cpp_init_stacks, cpp_init_macros, cpp_init_includes. (cpp_cleanup): Call cpp_cleanup_stacks, cpp_cleanup_macros, cpp_cleanup_includes. Don't destroy hashtab or all_include_files here. (cpp_finish): Use _cpp_report_missing_guards. * cppfiles.c (report_missing_guard): Moved from cppinit.c. (_cpp_init_include_table): Rename _cpp_init_includes. (_cpp_cleanup_includes, _cpp_report_missing_guards): New. * cppexp.c (parse_assertion): Update for new name of find_answer. * Makefile.in (cpplib.o, cpphash.o, cppinit.o): Update deps. * cpplib.c (do_ident): s/VSPACE/EOF/ testsuite: * gcc.dg/cpp/ident.c: New test. From-SVN: r34870
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r--gcc/cpplex.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index b0fba65..5f1707a 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -56,10 +56,6 @@ o Correct pastability test for CPP_NAME and CPP_NUMBER.
#include "cpphash.h"
#include "symcat.h"
-#ifdef HAVE_MMAP_FILE
-# include <sys/mman.h>
-#endif
-
#define auto_expand_name_space(list) \
_cpp_expand_name_space ((list), 1 + (list)->name_cap / 2)
static void safe_fwrite PARAMS ((cpp_reader *, const U_CHAR *,
@@ -227,78 +223,6 @@ _cpp_grow_token_buffer (pfile, n)
CPP_SET_WRITTEN (pfile, old_written);
}
-/* 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. */
-
-cpp_buffer *
-cpp_push_buffer (pfile, buffer, length)
- cpp_reader *pfile;
- const U_CHAR *buffer;
- long length;
-{
- cpp_buffer *buf = CPP_BUFFER (pfile);
- cpp_buffer *new;
- if (++pfile->buffer_stack_depth == CPP_STACK_MAX)
- {
- cpp_fatal (pfile, "macro or #include recursion too deep");
- return NULL;
- }
-
- new = (cpp_buffer *) xcalloc (1, sizeof (cpp_buffer));
-
- new->buf = new->cur = buffer;
- new->rlimit = buffer + length;
- new->prev = buf;
- new->line_base = NULL;
-
- CPP_BUFFER (pfile) = new;
- return new;
-}
-
-cpp_buffer *
-cpp_pop_buffer (pfile)
- cpp_reader *pfile;
-{
- cpp_buffer *buf = CPP_BUFFER (pfile);
-
- if (buf->inc)
- {
- _cpp_unwind_if_stack (pfile, buf);
- if (buf->buf)
- {
-#ifdef HAVE_MMAP_FILE
- if (buf->mapped)
- munmap ((caddr_t) buf->buf, buf->rlimit - buf->buf);
- else
-#endif
- free ((PTR) buf->buf);
- }
- if (pfile->system_include_depth)
- pfile->system_include_depth--;
- if (pfile->include_depth)
- pfile->include_depth--;
- if (pfile->potential_control_macro)
- {
- if (buf->inc->cmacro != NEVER_REREAD)
- buf->inc->cmacro = pfile->potential_control_macro;
- pfile->potential_control_macro = 0;
- }
- pfile->input_stack_listing_current = 0;
- /* If the file will not be included again, then close it. */
- if (DO_NOT_REREAD (buf->inc))
- {
- close (buf->inc->fd);
- buf->inc->fd = -1;
- }
- }
- CPP_BUFFER (pfile) = CPP_PREV_BUFFER (buf);
- free (buf);
- pfile->buffer_stack_depth--;
- return CPP_BUFFER (pfile);
-}
-
/* Deal with the annoying semantics of fwrite. */
static void
safe_fwrite (pfile, buf, len, fp)