diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-04-01 12:58:02 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-04-01 12:58:02 +0200 |
commit | d4c32e1d76fcbda6dc861b1867d55d5ca0acce8e (patch) | |
tree | 8a8f5b38d60fa065b109dbce3b10bb03f01befe1 /gcc/c-pch.c | |
parent | 764a79eda2a2e64329eea92b11a73bdfcdd18276 (diff) | |
download | gcc-d4c32e1d76fcbda6dc861b1867d55d5ca0acce8e.zip gcc-d4c32e1d76fcbda6dc861b1867d55d5ca0acce8e.tar.gz gcc-d4c32e1d76fcbda6dc861b1867d55d5ca0acce8e.tar.bz2 |
re PR pch/13675 (#including a precompiled header more than once in the same unit fails)
PR pch/13675
* files.c (struct _cpp_file): Remove pch field.
(pch_open_file): Don't set file->pch, just file->pchname.
(should_stack_file): After pfile->cb.read_pch call
free pchname and clear pchname, don't close file->fd.
Test file->pchname instead of file->pch. Don't close fd after cb.
(_cpp_stack_include): Test file->pchname instead of file->pch.
* c-pch.c (c_common_read_pch): On error close (fd) resp. fclose (f).
From-SVN: r133790
Diffstat (limited to 'gcc/c-pch.c')
-rw-r--r-- | gcc/c-pch.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c-pch.c b/gcc/c-pch.c index 691e12a..0da17f7 100644 --- a/gcc/c-pch.c +++ b/gcc/c-pch.c @@ -373,6 +373,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name, if (f == NULL) { cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen"); + close (fd); return; } @@ -381,6 +382,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name, if (fread (&h, sizeof (h), 1, f) != 1) { cpp_errno (pfile, CPP_DL_ERROR, "reading"); + fclose (f); return; } @@ -417,7 +419,10 @@ c_common_read_pch (cpp_reader *pfile, const char *name, gt_pch_restore (f); if (cpp_read_state (pfile, name, f, smd) != 0) - return; + { + fclose (f); + return; + } fclose (f); |