This is the mail archive of the
mailing list for the GCC project.
cpplib: reusing cached include files
- From: Per Bothner <per at bothner dot com>
- To: gcc-patches at gcc dot gnu dot org, Neil Booth <neil at daikokuya dot co dot uk>
- Date: Wed, 21 May 2003 11:49:28 -0700
- Subject: cpplib: reusing cached include files
cpplib contains code to cache the contents of an include file.
However, this code is currently disasbled, presumably because
it is incompatble with _cpp_clean_line. However, for the compile
server I really want to be able to re-used the cached buffer.
The following patch seems to more-or-less work. It's not quite
right, because I haven't attempted to get the line numbers right.
However, it shouldn't be too difficult to fix that by replacing
some of the spaces I've added by newlines instead.
Neil, what do you think? I'd really appreciate if we could
re-enable the cache.
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.170
diff -u -p -r1.170 cppfiles.c
--- cppfiles.c 16 May 2003 23:38:39 -0000 1.170
+++ cppfiles.c 21 May 2003 18:35:33 -0000
@@ -407,8 +413,18 @@ stack_include_file (pfile, inc)
+ if (inc->buffer)
+ if (0 /* FIXME: ! cached_version_is_current_according_to_stat
+ purge_cache (inc);
+ close (inc->fd);
+ inc->fd = -1;
/* Not in cache? */
- if (1 || ! inc->buffer)
+ if (! inc->buffer)
if (read_include_file (pfile, inc))
RCS file: /cvs/gcc/gcc/gcc/cpplex.c,v
retrieving revision 1.235
diff -u -p -r1.235 cpplex.c
--- cpplex.c 17 May 2003 20:29:31 -0000 1.235
+++ cpplex.c 21 May 2003 18:35:34 -0000
@@ -175,7 +175,12 @@ _cpp_clean_line (pfile)
- *d = '\n';
+ /* In kludge to support the compile server, which otherwise get
+ confused if trying re-using a buffer, trying to clean a line
+ that has already been cleaned. */
+ while (d < s)
+ *d++ = ' ';
+ /* *d = '\n'; */
/* A sentinel note that should never be processed. */
add_line_note (buffer, d + 1, '\n');
buffer->next_line = s + 1;