* cppfiles.c (open_file): If already read, then don't reopen.
Immediately close an empty file.
From-SVN: r37227
+2000-11-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cppfiles.c (open_file): If already read, then don't reopen.
+ Immediately close an empty file.
+
2000-11-01 Bernd Schmidt <bernds@redhat.co.uk>
* expr.h (fold_builtin): Move declaration...
if (file->fd == -2)
return 0;
- /* -1 indicates a file we've opened previously, and since closed. */
- if (file->fd != -1)
- return file;
+ /* Don't reopen an idempotent file. */
+ if (DO_NOT_REREAD (file))
+ return file;
+
+ /* Don't reopen one which is already loaded. */
+ if (file->buffer != NULL)
+ return file;
}
else
{
{
/* Mark a regular, zero-length file never-reread now. */
if (S_ISREG (file->st.st_mode) && file->st.st_size == 0)
- file->cmacro = NEVER_REREAD;
+ {
+ file->cmacro = NEVER_REREAD;
+ close (file->fd);
+ file->fd = -1;
+ }
return file;
}