This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR preprocessor/15167
Eric Botcazou <ebotcazou@libertysurf.fr> writes:
>> I'm looking at this bit of _cpp_stack_file:
>>
>> /* Clear buffer_valid since _cpp_clean_line messes it up. */
>> file->buffer_valid = false;
>> file->stack_count++;
>
> Sure, but it is guarded with:
>
> if (!should_stack_file (pfile, file, import))
> return false;
Yes, and in that case the buffer never gets passed to cpp_push_buffer,
so again _cpp_pop_buffer should never see it.
>> Ugh. That's not supposed to happen. (This is not your fault - the
>> file-cache data structure has been broken for a long time.)
>
> Then why does the following code exist?
...
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
numbers.)
zw