This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR preprocessor/15167
> I see nothing that would cause it to become true once again. It is
> only set to true in read_file_guts, which has already happened at the
> point where _cpp_stack_file clears buffer_valid.
But read_file is invoked in the comparison routine for each new instance that
is tentatively pushed!
/* We may have read the file under a different name. Look
for likely candidates and compare file contents to be sure. */
for (f = pfile->all_files; f; f = f->next_file)
{
if (f == file)
continue;
if ((import || f->once_only)
&& f->err_no == 0
&& f->st.st_mtime == file->st.st_mtime
&& f->st.st_size == file->st.st_size
&& read_file (pfile, f)
/* Size might have changed in read_file(). */
&& f->st.st_size == file->st.st_size
&& !memcmp (f->buffer, file->buffer, f->st.st_size))
break;
}
b.h (the pragma-onced header) is first pushed, then another instance is
tentatively pushed. Then the first instance is popped and a new instance is
tentatively pushed again.
> Neil is not being as picky as me. The primary problem is that the
> #ifndef wrapper idiom has not been reliably optimized for some time -
> I'm not sure whether it broke with the big PCH patch, or when the
> "missing-include" hook was introduced. Also, the sheer
> incomprehensibility of this logic is itself a problem. And in my
> ideal world we would never have to read and memcmp() the files to
> determine whether #pragma once applies.
OK. I'm actually only interested in fixing the problem on the 3.4 branch.
--
Eric Botcazou