From: "Torbjörn SVENSSON" <torbjorn.svensson@foss.st.com>
To: <gcc-patches@gcc.gnu.org>
Cc: tromey@redhat.com, yvan.roux@foss.st.com,
"Torbjörn SVENSSON" <torbjorn.svensson@foss.st.com>
Subject: [PATCH] cpp/remap: Only override if string matched
Date: Thu, 20 Oct 2022 22:48:26 +0200 [thread overview]
Message-ID: <20221020204825.3248771-1-torbjorn.svensson@foss.st.com> (raw)
For systems with HAVE_DOS_BASED_FILE_SYSTEM set, only override the
pointer if the backslash pattern matches.
Output without this patch:
.../gcc/testsuite/gcc.dg/cpp/pr71681-2.c:5:10: fatal error: a/t2.h: No such file or directory
With patch applied, no output and the test case succeeds.
libcpp/ChangeLog
* files.cc: Ensure pattern matches before use.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
libcpp/files.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcpp/files.cc b/libcpp/files.cc
index 24208f7b0f8..a18b1caf48d 100644
--- a/libcpp/files.cc
+++ b/libcpp/files.cc
@@ -1833,7 +1833,7 @@ remap_filename (cpp_reader *pfile, _cpp_file *file)
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
const char *p2 = strchr (fname, '\\');
- if (!p || (p > p2))
+ if (!p || (p2 && p > p2))
p = p2;
}
#endif
--
2.25.1
next reply other threads:[~2022-10-20 20:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 20:48 Torbjörn SVENSSON [this message]
2022-11-02 18:21 ` PING^1 " Torbjorn SVENSSON
2022-11-17 16:44 ` PING^2 " Torbjorn SVENSSON
2022-11-20 20:31 ` PING^1 " Jeff Law
2022-11-21 12:38 ` Torbjorn SVENSSON
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=20221020204825.3248771-1-torbjorn.svensson@foss.st.com \
--to=torbjorn.svensson@foss.st.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=tromey@redhat.com \
--cc=yvan.roux@foss.st.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).