This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

-remap: Should we remap before / after simplification?


CPP simplifies pathnames so that, e.g., 

a/b/c/../d   -> a/b/d

internally.  Now consider what happens in the case that "a/b/c" is a
directory with header remappings.  CPP presently looks in the remap file
for whether a file name should be remapped, * but it looks after doing
the path simplification above and still assumes the resulting name begins
with a/b/c *.  In other words, in the above case, rather than looking
for a map for "../d" it looks for a map for "" (and is lucky it isn't
beyond the end of the string in this case).

This is obviously broken; the question is how to fix it.  It seems that
the only sensible fix is to do filename simplification *after* remapping
the filename.

The same bug is also inherently making the assumption that the mapped-to
file will be in the same directory; I see no reason for us to demand
that either.

Would someone who uses this stuff agree or disagree?  I don't really
see another way to do this and remain correct, to be honest.

Neil.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]