summaryrefslogtreecommitdiffstats
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-13 02:32:41 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-13 02:32:41 +0000
commit241e762ee7945bc224c331bfe68ef2de97397350 (patch)
treef6656bb21e208ce3d9194a471d84e8b7a0fdac65 /gcc/cppfiles.c
parentc4b2e2d7cf9b748e87d521f4633e1f2263decfbc (diff)
downloadppe42-gcc-241e762ee7945bc224c331bfe68ef2de97397350.tar.gz
ppe42-gcc-241e762ee7945bc224c331bfe68ef2de97397350.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35003 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 41706411ee7..2b153719e5c 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
OpenPOWER on IntegriCloud