libcpp/remap: Only override if string matched
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Thu, 20 Oct 2022 20:38:57 +0000 (22:38 +0200)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Mon, 21 Nov 2022 12:37:05 +0000 (13:37 +0100)
commit711f56ad9093b18197ca82415317f4a3748d45ae
treeed48ffd9bc30538ec824f744906aec773ebda6f3
parentccb9c7b129206209cfc315ab1a0432b5f517bdd9
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>
libcpp/files.cc