This is the mail archive of the gcc@gcc.gnu.org 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]
Other format: [Raw text]

Tweaking the pathname for __FILE__


The full pathname in __FILE__ is sometimes more than is desirable.  For example, if multiple people may be building software in different working directories, you end up with binaries that have lots of differences in them that obscure "real" changes.  Or it may be that rebuilding "the bits we had back in SVN rev 12345" is made harder this way, which can hurt debugging.

It would be useful to be able to have __FILE__ be a portion of the full path name.  I tried makefile magic that undefines and redefines __FILE__, but that runs into the issue that the compiler is protective about that name and makes it a warning to try this.  And with -Werror, that kills the compile...  -w appears to avoid that, but that's not a good solution.

It occurred to me that this might be an issue others have run into.  Would it be useful for gcc to provide some way to have the __FILE__ value trimmed?  Perhaps something analogous to the -p switch in the "patch" utility?

I can easily make something like this a private change, of course, but if there is interest in this as a common feature I can do it that way instead.

	paul


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