public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/47047] New: Support for path translation in __FILE__
@ 2010-12-23  2:12 joerg at netbsd dot org
  2010-12-23 12:16 ` [Bug preprocessor/47047] " joseph at codesourcery dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: joerg at netbsd dot org @ 2010-12-23  2:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047

           Summary: Support for path translation in __FILE__
           Product: gcc
           Version: 4.1.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: joerg@netbsd.org


Created attachment 22841
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22841
Implement cpp -iremap

__FILE__ expands to full path names in some situation, e.g. if it is used in a
header found via -I/some/where. The resulting leak of the header location into
the file binary is undesirable in certain situations.

For NetBSD, two relevant cases are the visiblity protection in pkgsrc, which
effectively turns /usr/pkg/include/foo into /.../work/.buildlink/include/foo
and cross-compiling the system, which would leak /.../usr/include/foo instead
of /usr/include/foo or the location of the source tree.

The attached patch implements a CPP option to match the file path against a
list of prefixes and substitute the prefix on match. With this patch, most
references to the src and obj locations in NetBSD can be translated into the
canonical positions.

The patch is the version included in NetBSD against the system gcc, it can be
updated if necessary.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-03-15  4:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-23  2:12 [Bug preprocessor/47047] New: Support for path translation in __FILE__ joerg at netbsd dot org
2010-12-23 12:16 ` [Bug preprocessor/47047] " joseph at codesourcery dot com
2010-12-23 12:51 ` joerg at britannica dot bec.de
2010-12-23 16:14 ` joseph at codesourcery dot com
2011-02-06  4:10 ` joerg at netbsd dot org
2013-04-07 21:29 ` dank at kegel dot com
2013-04-08  8:11 ` joerg at netbsd dot org
2024-03-15  4:00 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).