diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-03 16:03:37 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-03 16:03:37 +0000 |
commit | 2d65eaf5e821de9d707af4f4913c03d6372350bb (patch) | |
tree | b3e2c442f061fc7379989b80f9d5ee2b7118618f /gcc/cppfiles.c | |
parent | 126bf5547cd629825341a8fb69e270dd23dbefa3 (diff) | |
download | gcc-2d65eaf5e821de9d707af4f4913c03d6372350bb.tar.gz |
* cppfiles.c (open_file): If already read, then don't reopen.
Immediately close an empty file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37227 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r-- | gcc/cppfiles.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 1009fa784a1..47bf43f211f 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -145,9 +145,13 @@ open_file (pfile, filename) 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 { @@ -181,7 +185,11 @@ open_file (pfile, filename) { /* 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; } |