[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

Joerg Sonnenberger via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 4 04:23:53 PST 2016


On Thu, Mar 03, 2016 at 04:50:11PM -0800, Nico Weber via cfe-commits wrote:
> On Thu, Mar 3, 2016 at 4:28 PM, Joerg Sonnenberger via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
> 
> > On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote:
> > > On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits <
> > > cfe-commits at lists.llvm.org> wrote:
> > >
> > > > On Thu, Mar 03, 2016 at 07:39:04PM +0000, Weiming Zhao via cfe-commits
> > > > wrote:
> > > > > Change the option name to -ffile-macro-prefix-to-remove
> > > >
> > > > This still sounds to me like a solution for a very restricted part of a
> > > > much more generic problem...
> > > >
> > >
> > > What do you mean?
> >
> > Storing only the base name of file names is a strict subset of __FILE__
> > transformations. As mentioned in the linked GCC PR, other uses are
> > creating build location independent output for larger software projects
> > etc. For that, reducing to the base name is not an option as it removes
> > too much information.
> >
> 
> But ffile-macro-prefix-to-remove has a general prefix arg, which you can
> set to your build dir. This isn't just a "get me the basename" flag (?)

It doesn't help to make sure that path names are always using /usr/src
or src/ and build/ without requiring those to be part of the build
layout. Another instance not handled is symlink trees for controlling
access, where you still want to use the original path etc.

Joerg


More information about the cfe-commits mailing list