This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix PR preprocessor/15167
Eric Botcazou <firstname.lastname@example.org> writes:
>> Yes, and in that case the buffer never gets passed to cpp_push_buffer,
>> so again _cpp_pop_buffer should never see it.
> No. The first instance is of course pushed, so file->buffer_valid
> successively becomes false and true.
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.
>> Precisely because the file-cache data structure is broken. It's best
>> thought of as a kludge workaround since no one has time to make the
>> file-identity detection work 100% without it. (It is very hard to
>> make it get *all* the special cases right, particularly in the
>> presence of symbolic or hard links. In fact, in some cases it may be
>> downright impossible - e.g. if the OS doesn't provide meaningful inode
> See Neil's comment in the audit trail of the PR.
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.