[PATCH] support for obtaining file basename

Robert Millan rmh@aybabtu.com
Sat Jan 2 11:39:00 GMT 2010


On Sat, Jan 02, 2010 at 12:05:46PM +0100, Richard Guenther wrote:
> On Sat, Jan 2, 2010 at 11:11 AM, Robert Millan <rmh@aybabtu.com> wrote:
> >
> > Please consider this patch.  It adds support for obtaining file basename via
> > __FILE_BASENAME__.
> >
> > This would be used by GNU GRUB.  I'll provide some explanation on why this is
> > very necessary for us:
> >
> >  - Bootloader code is very critical; a bug can render system unbootable.
> > Additionally, it needs to support a wide range of hardware and firmware.
> > Because of this, we put extensive debugging support into GRUB.  Debug
> > statements currently rely on __FILE__.
> >
> >  - We want to support $srcdir != $objdir build setups, and continue supporting
> > them.
> >
> >  - Some parts of bootstrap code tend to be very size constrained.  Every byte
> > counts, and each debug statement is taking unnecessary space because accessing
> > a file in $srcdir requires either an absolute path or at least a number of
> > '../' components (in Debian, that would be two of them).
> >
> > Because of this, I would find it very useful if GCC provided __FILE_BASENAME__,
> > or at least an equivalent facility.
> >
> >
> > Also filed as: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42579
> 
> You can try __BASE_FILE__ instead.

Hi,

I tried already, but __BASE_FILE__ seems to be something unrelated.  It's
like __FILE__ but when used in an #include'd source it picks the includer
rather than the included file.

Thanks

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi



More information about the Gcc-patches mailing list