From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Jeff Law <jeffreyalaw@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/2] libcpp: Avoid remapping filenames within directives
Date: Wed, 02 Nov 2022 10:52:41 +0000 [thread overview]
Message-ID: <90f05d0e7dc209b554431ab56ec6aab92ae6f5c6.camel@linuxfoundation.org> (raw)
In-Reply-To: <abb7c6d1-65cb-3335-8e3e-4edcf7af103e@gmail.com>
On Tue, 2022-11-01 at 13:32 -0600, Jeff Law wrote:
> On 8/17/22 06:15, Richard Purdie via Gcc-patches wrote:
> > Code such as:
> #include __FILE__
> >
> > can interact poorly with file-prefix-map options when cross compiling. In
> > general you're after to remap filenames for use in target context but the
> > local paths should be used to find include files at compile time. Ingoring
> > filename remapping for directives is one way to avoid such failures.
> >
> > libcpp/ChangeLog:
> >
> > * macro.cc (_cpp_builtin_macro_text): Don't remap filenames within directives
>
> So I went back and reviewed the old PR which introduced this code. It
> was actually the Yocto project that got this code in to begin with :-)
Thanks for the review!
That sounds right, we use it heavily and originally had a few issues in
this area. It now generally works really well, we just found this
corner case :)
> There wasn't really any discussion AFAICT about whether or not to remap
> in directives that I saw in the PR.
I don't think we'd realised there was this corner case. Now we have
found code doing it, I think the behaviour we should have is fairly
clear which is why we're sending the patch.
> ISTM that given the change in behavior, we should probably document that
> we don't remap in directives. Probably doc/invoke.texi.
>
> With suitable documentation, this should be fine. It seems like it
> ought to be independent of the first patch in this series which adds
> support for remapping relative paths.
Thanks for merging 1/2, it was independent, just related as a path
mapping issue we found. I'll keep the coding style in mind in future.
I've sent a new version of this patch which updates doc/invoke.texi,
just adding to file-prefix-map as the others all reference it.
Cheers,
Richard
next prev parent reply other threads:[~2022-11-02 10:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 12:15 [PATCH 1/2] gcc/file-prefix-map: Allow remapping of relative paths Richard Purdie
2022-08-17 12:15 ` [PATCH 2/2] libcpp: Avoid remapping filenames within directives Richard Purdie
2022-08-17 14:19 ` Richard Purdie
2022-11-01 19:32 ` Jeff Law
2022-11-02 10:52 ` Richard Purdie [this message]
2022-11-01 19:46 ` [PATCH 1/2] gcc/file-prefix-map: Allow remapping of relative paths Jeff Law
2023-01-19 13:06 ` Jakub Jelinek
2023-01-20 15:05 ` [PATCH] file-prefix-map: Fix up -f*-prefix-map= [PR108464] Jakub Jelinek
2023-01-23 15:39 ` Jakub Jelinek
2023-03-10 8:49 ` Patch ping - " Jakub Jelinek
2023-03-10 9:05 ` Richard Biener
2023-03-10 10:14 ` Richard Purdie
2022-11-04 9:12 ` [PATCH 1/2] gcc/file-prefix-map: Allow remapping of relative paths Eric Botcazou
2022-11-04 17:21 ` Richard Purdie
2022-11-07 8:01 ` Eric Botcazou
2022-11-07 16:21 ` Jeff Law
2022-11-07 16:36 ` Eric Botcazou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90f05d0e7dc209b554431ab56ec6aab92ae6f5c6.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).