This is the mail archive of the
mailing list for the GCC project.
Re: [CPP patch]: -M default name
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Subject: Re: [CPP patch]: -M default name
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Tue, 6 Feb 2001 19:00:24 +0000
- Cc: gcc-patches at gcc dot gnu dot org, Zack Weinberg <zackw at Stanford dot EDU>,Tom Tromey <tromey at cygnus dot com>
- References: <3A7FD18F.26C2B71@codesourcery.com>
Nathan Sidwell wrote:-
> this patch makes the default dependency target name have no directory
> component, and reverts the behaviour of your patch of
> 2001-01-05 Neil Booth <firstname.lastname@example.org>
> what was the rationale for that? It's breaking something like
> gcc -MD src/file.c
> we get a file.o and a file.d, but file.d says the target is src/file.o
Hmmm. The reason I did it was the following case (run from any
bash-2.04$ gcc -MM /tmp/test.c
/tmp/test.o: /tmp/test.c /tmp/test.h
I thought we should keep the path of the source file.
> See bug 1881, for which this is a problem. If there are good reasons
> for the current behaviour, then we need to change the specs in gcc.c
> to set the target name correctly.
This might be the better solution, I'm not sure. I'd like feedback
from Zack and / or Tom if possible.
There are 2 things wrong with your patch, if we do decide it's the way
1) You should use libiberty's basename () function
2) You need to call basename () before scanning for the prefix, otherwise
files with a "." in the name of the directory, such as our testsuite
directories, will get mangled in the (unlikely) case of a file
without an extension.