diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-07-13 02:32:41 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-07-13 02:32:41 +0000 |
commit | f9a0e96c1707a7f48f7d152901740444098c2628 (patch) | |
tree | f6656bb21e208ce3d9194a471d84e8b7a0fdac65 /gcc/cppfiles.c | |
parent | d55bb5be913e11b1ba639c124403ef0cd7e11517 (diff) | |
download | gcc-f9a0e96c1707a7f48f7d152901740444098c2628.zip gcc-f9a0e96c1707a7f48f7d152901740444098c2628.tar.gz gcc-f9a0e96c1707a7f48f7d152901740444098c2628.tar.bz2 |
cppexp.c, [...]: Eradicate all traces of code dependent on traditional, lang_chill, or lang_fortran.
* cppexp.c, cpphash.c, cpphash.h, cppinit.c, cpplex.c,
cpplib.c, cpplib.h: Eradicate all traces of code dependent on
traditional, lang_chill, or lang_fortran.
* cppfiles.c: #undef strcmp to suppress warning about macros
used without arguments.
(_cpp_execute_include): Use f, not fname, in "No include path"
error.
(_cpp_pop_file_buffer): New function.
* cpplib.c: Don't include <sys/mman.h>.
(cpp_push_buffer): Set line_base and lineno in new buffer.
(cpp_pop_buffer): Use _cpp_pop_file_buffer.
* cpplex.c: Move all prototypes and structure declarations to the
top of the file. Properly parenthesise some macro arguments.
(cpp_scan_line): New function.
(special_symbol [case T_INCLUDE_DEPTH]): Use pfile->include_depth,
don't need to walk up the stack counting.
From-SVN: r35003
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r-- | gcc/cppfiles.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 4170641..2b15371 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -43,6 +43,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # define O_BINARY 0 #endif +/* Suppress warning about function macros used w/o arguments in traditional + C. It is unlikely that glibc's strcmp macro helps this file at all. */ +#undef strcmp + static struct file_name_map *read_name_map PARAMS ((cpp_reader *, const char *)); static char *read_filename_string PARAMS ((int, FILE *)); @@ -423,7 +427,7 @@ _cpp_execute_include (pfile, f, len, no_reinclude, search_start, angle_brackets) if (!search_start) { - cpp_error (pfile, "No include path in which to find %s", fname); + cpp_error (pfile, "No include path in which to find %s", f); return; } @@ -762,6 +766,44 @@ read_with_read (fp, fd, size) return offset; } +/* Do appropriate cleanup when a file buffer is popped off the input + stack. */ +void +_cpp_pop_file_buffer (pfile, buf) + cpp_reader *pfile; + cpp_buffer *buf; +{ + struct include_file *inc = buf->inc; + + if (pfile->system_include_depth) + pfile->system_include_depth--; + if (pfile->include_depth) + pfile->include_depth--; + if (pfile->potential_control_macro) + { + if (inc->cmacro != NEVER_REREAD) + inc->cmacro = pfile->potential_control_macro; + pfile->potential_control_macro = 0; + } + pfile->input_stack_listing_current = 0; + + /* Discard file buffer. XXX Would be better to cache these instead + of the file descriptors. */ +#ifdef HAVE_MMAP_FILE + if (buf->mapped) + munmap ((caddr_t) buf->buf, buf->rlimit - buf->buf); + else +#endif + free ((PTR) buf->buf); + + /* If the file will not be included again, close it. */ + if (DO_NOT_REREAD (inc)) + { + close (inc->fd); + inc->fd = -1; + } +} + /* The file_name_map structure holds a mapping of file names for a particular directory. This mapping is read from the file named FILE_NAME_MAP_FILE in that directory. Such a file can be used to |