This is the mail archive of the 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]

Re: [CPP patch]: -M default name

Hi Nathan,

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  <>
> 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
to go:

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.


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