diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-09-12 03:42:30 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-09-12 03:42:30 +0000 |
commit | a58d32c208153b93994f6bc1a26dd35e4b58c994 (patch) | |
tree | b6a034134f9f646df618389e79a9becaa26938a5 /gcc/cpphash.h | |
parent | 4ba01ed2ae8beb00e653be369f423a452ed6f363 (diff) | |
download | gcc-a58d32c208153b93994f6bc1a26dd35e4b58c994.zip gcc-a58d32c208153b93994f6bc1a26dd35e4b58c994.tar.gz gcc-a58d32c208153b93994f6bc1a26dd35e4b58c994.tar.bz2 |
cppfiles.c: Move all default-#defines to top of file.
* 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.
From-SVN: r36347
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r-- | gcc/cpphash.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h index 45abb69..41d5b9e 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)) |