public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4203] libcpp/remap: Only override if string matched
@ 2022-11-21 12:37 Torbjorn Svensson
0 siblings, 0 replies; only message in thread
From: Torbjorn Svensson @ 2022-11-21 12:37 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:711f56ad9093b18197ca82415317f4a3748d45ae
commit r13-4203-g711f56ad9093b18197ca82415317f4a3748d45ae
Author: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Date: Thu Oct 20 22:38:57 2022 +0200
libcpp/remap: Only override if string matched
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>
Diff:
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-21 12:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 12:37 [gcc r13-4203] libcpp/remap: Only override if string matched Torbjorn Svensson
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).