From 76e5465a229f975f67e161163edd64d397e7548d Mon Sep 17 00:00:00 2001 From: zack Date: Tue, 12 Sep 2000 03:42:30 +0000 Subject: * cppfiles.c: Move all default-#defines to top of file. (open_include_file): Replace by lookup_include_file. (read_with_read, read_file): Merged into read_include_file. (stack_include_file, purge_cache): New functions. (close_cached_fd): Delete. (lookup_include_file, read_include_file, _cpp_pop_file_buffer): Cache the in-memory buffer, not the file descriptor. * cpphash.h (struct include_file): Add buffer, st, refcnt, mapped fields. (xcnew): New utility macro. (DO_NOT_REREAD, NEVER_REREAD): Move up by struct include_file. * cpplib.h (struct cpp_buffer): Remove mapped field. * cpplex.c (parse_string): Accept backslash space newline as a line continuation. (lex_line): Likewise. (_cpp_get_token): Remove hard limit on macro nesting. testsuite: * gcc.dg/cpp/backslash.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36347 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cpphash.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'gcc/cpphash.h') diff --git a/gcc/cpphash.h b/gcc/cpphash.h index 45abb691975..41d5b9e5a7f 100644 --- a/gcc/cpphash.h +++ b/gcc/cpphash.h @@ -115,12 +115,24 @@ struct include_file const struct file_name_list *foundhere; /* location in search path where file was found, for #include_next */ - int fd; /* file descriptor possibly open on file */ + const unsigned char *buffer; /* pointer to cached file contents */ + struct stat st; /* copy of stat(2) data for file */ + int fd; /* fd open on file (short term storage only) */ unsigned short include_count; /* number of times file has been read */ - unsigned short sysp; /* file is a system header */ - time_t date; /* modification date of file, if known */ + unsigned short refcnt; /* number of stacked buffers using this file */ + unsigned char sysp; /* file is a system header */ + unsigned char mapped; /* file buffer is mmapped */ }; +/* The cmacro works like this: If it's NULL, the file is to be + included again. If it's NEVER_REREAD, the file is never to be + included again. Otherwise it is a macro hashnode, and the file is + to be included again if the macro is not defined. */ +#define NEVER_REREAD ((const cpp_hashnode *)-1) +#define DO_NOT_REREAD(inc) \ +((inc)->cmacro && \ + ((inc)->cmacro == NEVER_REREAD || (inc)->cmacro->type != T_VOID)) + /* Special nodes - identifiers with predefined significance. Note that the array length of dirs[] must be kept in sync with cpplib.c's dtable[]. */ @@ -133,16 +145,6 @@ struct spec_nodes cpp_hashnode *dirs[19]; /* 19 directives counting #sccs */ }; - -/* The cmacro works like this: If it's NULL, the file is to be - included again. If it's NEVER_REREAD, the file is never to be - included again. Otherwise it is a macro hashnode, and the file is - to be included again if the macro is not defined. */ -#define NEVER_REREAD ((const cpp_hashnode *)-1) -#define DO_NOT_REREAD(inc) \ -((inc)->cmacro && \ - ((inc)->cmacro == NEVER_REREAD || (inc)->cmacro->type != T_VOID)) - /* Character classes. If the definition of `numchar' looks odd to you, please look up the definition of a pp-number in the C standard [section 6.4.8 of C99]. @@ -293,6 +295,7 @@ extern void _cpp_init_internal_pragmas PARAMS ((cpp_reader *)); /* Utility routines and macros. */ #define xnew(T) (T *) xmalloc (sizeof(T)) +#define xcnew(T) (T *) xcalloc (1, sizeof(T)) #define xnewvec(T, N) (T *) xmalloc (sizeof(T) * (N)) #define xcnewvec(T, N) (T *) xcalloc (N, sizeof(T)) #define xobnew(O, T) (T *) obstack_alloc (O, sizeof(T)) -- cgit v1.2.1