This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-remap: Should we remap before / after simplification?
- To: gcc at gcc dot gnu dot org
- Subject: -remap: Should we remap before / after simplification?
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Wed, 14 Mar 2001 07:44:14 +0000
- Cc: Zack Weinberg <zackw at Stanford dot EDU>
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.