Commit 230fcd32 by Phil Edwards Committed by Benjamin Kosnik

re PR pch/12112 (Putting PCH files in a directory completely broken)


2003-09-24  Phil Edwards  <phil@codesourcery.com>

	PR pch/12112
	* gcc/cppfiles.c (pch_open_file): Return based on combined
        result of all files.
	(validate_pch): Return validate flag for current file.

From-SVN: r71751
parent 3d5cd600
2003-09-24 Phil Edwards <phil@codesourcery.com>
PR pch/12112
* gcc/cppfiles.c (pch_open_file): Return based on combined
result of all files.
(validate_pch): Return validate flag for current file.
2003-09-24 Roger Sayle <roger@eyesopen.com> 2003-09-24 Roger Sayle <roger@eyesopen.com>
PR bootstrap/12358 PR bootstrap/12358
......
...@@ -273,6 +273,9 @@ pch_open_file (cpp_reader *pfile, _cpp_file *file) ...@@ -273,6 +273,9 @@ pch_open_file (cpp_reader *pfile, _cpp_file *file)
while ((d = readdir (pchdir)) != NULL) while ((d = readdir (pchdir)) != NULL)
{ {
dlen = strlen (d->d_name) + 1; dlen = strlen (d->d_name) + 1;
if ((strcmp (d->d_name, ".") == 0)
|| (strcmp (d->d_name, "..") == 0))
continue;
if (dlen + plen > len) if (dlen + plen > len)
{ {
len += dlen + 64; len += dlen + 64;
...@@ -285,6 +288,7 @@ pch_open_file (cpp_reader *pfile, _cpp_file *file) ...@@ -285,6 +288,7 @@ pch_open_file (cpp_reader *pfile, _cpp_file *file)
} }
closedir (pchdir); closedir (pchdir);
} }
file->pch |= valid;
} }
if (valid) if (valid)
...@@ -1185,14 +1189,14 @@ static bool ...@@ -1185,14 +1189,14 @@ static bool
validate_pch (cpp_reader *pfile, _cpp_file *file, const char *pchname) validate_pch (cpp_reader *pfile, _cpp_file *file, const char *pchname)
{ {
const char *saved_path = file->path; const char *saved_path = file->path;
bool valid = false;
file->path = pchname; file->path = pchname;
if (open_file (file)) if (open_file (file))
{ {
if ((file->pch & 2) == 0) valid = 1 & pfile->cb.valid_pch (pfile, pchname, file->fd);
file->pch = pfile->cb.valid_pch (pfile, pchname, file->fd);
if (!include_pch_p (file)) if (!valid)
{ {
close (file->fd); close (file->fd);
file->fd = -1; file->fd = -1;
...@@ -1204,12 +1208,10 @@ validate_pch (cpp_reader *pfile, _cpp_file *file, const char *pchname) ...@@ -1204,12 +1208,10 @@ validate_pch (cpp_reader *pfile, _cpp_file *file, const char *pchname)
for (i = 1; i < pfile->line_maps.depth; i++) for (i = 1; i < pfile->line_maps.depth; i++)
putc ('.', stderr); putc ('.', stderr);
fprintf (stderr, "%c %s\n", fprintf (stderr, "%c %s\n",
include_pch_p (file) ? '!' : 'x', pchname); valid ? '!' : 'x', pchname);
} }
} }
else
file->pch = 2;
file->path = saved_path; file->path = saved_path;
return include_pch_p (file); return valid;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment