On 10 Jul 2003, Zack Weinberg <[EMAIL PROTECTED]> wrote: > Thank you for the clear explanation. The conclusion I draw from it is > that we should turn this mode on when and only when it affects the > output of the compiler. Would you, Martin, be willing to do some > research and figure out under exactly what conditions this makes a > difference?
I am fairly sure that the only effect of the pwd is on the debugging information. I have not checked the gcc source to make sure, but I have not seen any cases to contradict this. Several people have asked about this with ccache and distcc and always in relation to debugging. The point of that field (just to recap) is this: suppose I compile a program with something like cd ~/work/foo && gcc -o foo src/foo.c Then gcc embeds both the filename "src/foo.c" and the basis directory "/home/mbp/work/foo" into the debug information of the binary. This means that later on, if I open gdb on the program, it will be able to find the source, even if I'm not in that directory and even if the binary has been moved somewhere else. This is also useful in the case of a recursive make where different files of the same name are compiled in various subdirectories. gdb has a "directory" command to say where to find the source so this is just a convenience measure. And indeed it can fail if e.g. I move the directory after building it. There is some potential for confusion in various cases even without distcc or ccache, but it mostly works. The most common is probably renaming a directory after you build in it. (In fact, I'm sure I hit something like this years ago but it was one of those cases where you just shrug, recompile and move along.) A problem with the current implementation is that it embeds cc1's directory but really we're interested in the location of the source, which is properly cpp's responsibility. The pwd is not available "to the user" through anything like __FILE__, which I think is a good thing. If you wanted to embed this e.g. for version-stamping it can be easily done with -DBUILD_DIR=\"`pwd`\". > Also, I agree with Neil, this has nothing to do with dependency > output, it shouldn't be an -M option. If it affects only debug > information, let's make it -g(no-)pwd, otherwise -f(no-)pwd. -g seems to make most sense, unless there is some plan to use the information elsewhere. Is it OK for cpp to understand -g options? Should -gno-pwd give the existing behaviour of embedding cc1's pwd, or will it force the directory to be ""? >From the point of view of ccache and distcc users, I think the ideal would be for the directory information to on by default if -g is specified, and otherwise off. -- Martin __ distcc mailing list http://distcc.samba.org/ To unsubscribe or change options: http://lists.samba.org/cgi-bin/mailman/listinfo/distcc
