This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -remap: Should we remap before / after simplification?
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Subject: Re: -remap: Should we remap before / after simplification?
- From: "Zack Weinberg" <zackw at Stanford dot EDU>
- Date: Wed, 14 Mar 2001 00:48:10 -0800
- Cc: gcc at gcc dot gnu dot org
- References: <20010314074414.N4250@daikokuya.demon.co.uk>
On Wed, Mar 14, 2001 at 07:44:14AM +0000, Neil Booth wrote:
> 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.
That seems like a reasonable change to me. Talk to the DJGPP folks,
they are the only ones who use this feature.
> 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.
I believe it's only ever used to map to files in the same directory,
but there's no reason not to allow it to go elsewhere.
zw