aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2022-10-20 22:38:57 +0200
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2022-11-21 13:37:05 +0100
commit711f56ad9093b18197ca82415317f4a3748d45ae (patch)
treeed48ffd9bc30538ec824f744906aec773ebda6f3 /libcpp
parentccb9c7b129206209cfc315ab1a0432b5f517bdd9 (diff)
downloadgcc-711f56ad9093b18197ca82415317f4a3748d45ae.zip
gcc-711f56ad9093b18197ca82415317f4a3748d45ae.tar.gz
gcc-711f56ad9093b18197ca82415317f4a3748d45ae.tar.bz2
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>
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/files.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcpp/files.cc b/libcpp/files.cc
index 24208f7..a18b1ca 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