summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-rh251682.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-rh251682.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-rh251682.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-rh251682.patch b/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-rh251682.patch
new file mode 100644
index 0000000000..e96ae6f134
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-rh251682.patch
@@ -0,0 +1,89 @@
12008-04-01 Jakub Jelinek <jakub@redhat.com>
2
3 PR pch/13675
4 * files.c (struct _cpp_file): Remove pch field.
5 (pch_open_file): Don't set file->pch, just file->pchname.
6 (should_stack_file): After pfile->cb.read_pch call
7 free pchname and clear pchname, don't close file->fd.
8 Test file->pchname instead of file->pch. Don't close fd after cb.
9 (_cpp_stack_include): Test file->pchname instead of file->pch.
10
11 * c-pch.c (c_common_read_pch): On error close (fd) resp. fclose (f).
12
13--- libcpp/files.c.jj 2008-02-18 23:50:17.000000000 +0100
14+++ libcpp/files.c 2008-03-31 15:59:01.000000000 +0200
15@@ -106,9 +106,6 @@ struct _cpp_file
16
17 /* If BUFFER above contains the true contents of the file. */
18 bool buffer_valid;
19-
20- /* File is a PCH (on return from find_include_file). */
21- bool pch;
22 };
23
24 /* A singly-linked list for all searches for a given file name, with
25@@ -322,9 +319,7 @@ pch_open_file (cpp_reader *pfile, _cpp_f
26 }
27 closedir (pchdir);
28 }
29- if (valid)
30- file->pch = true;
31- else
32+ if (!valid)
33 *invalid_pch = true;
34 }
35
36@@ -703,11 +698,12 @@ should_stack_file (cpp_reader *pfile, _c
37 return false;
38
39 /* Handle PCH files immediately; don't stack them. */
40- if (file->pch)
41+ if (file->pchname)
42 {
43 pfile->cb.read_pch (pfile, file->pchname, file->fd, file->path);
44- close (file->fd);
45 file->fd = -1;
46+ free ((void *) file->pchname);
47+ file->pchname = NULL;
48 return false;
49 }
50
51@@ -916,7 +912,7 @@ _cpp_stack_include (cpp_reader *pfile, c
52 complicates LAST_SOURCE_LINE_LOCATION. This does not apply if we
53 found a PCH file (in which case linemap_add is not called) or we
54 were included from the command-line. */
55- if (! file->pch && file->err_no == 0 && type != IT_CMDLINE)
56+ if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
57 pfile->line_table->highest_location--;
58
59 return _cpp_stack_file (pfile, file, type == IT_IMPORT);
60--- gcc/c-pch.c.jj 2008-02-18 23:46:08.000000000 +0100
61+++ gcc/c-pch.c 2008-03-31 15:56:00.000000000 +0200
62@@ -372,6 +372,7 @@ c_common_read_pch (cpp_reader *pfile, co
63 if (f == NULL)
64 {
65 cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
66+ close (fd);
67 return;
68 }
69
70@@ -380,6 +381,7 @@ c_common_read_pch (cpp_reader *pfile, co
71 if (fread (&h, sizeof (h), 1, f) != 1)
72 {
73 cpp_errno (pfile, CPP_DL_ERROR, "reading");
74+ fclose (f);
75 return;
76 }
77
78@@ -425,7 +427,10 @@ c_common_read_pch (cpp_reader *pfile, co
79 gt_pch_restore (f);
80
81 if (cpp_read_state (pfile, name, f, smd) != 0)
82- return;
83+ {
84+ fclose (f);
85+ return;
86+ }
87
88 fclose (f);
89