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. -- Summary: [PATCH] support for obtaining file basename Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rmh dot gcc at aybabtu dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42579