public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/pheeck/heads/sccp)] libcpp/remap: Only override if string matched
@ 2023-02-15 10:16 Filip Kastl
  0 siblings, 0 replies; only message in thread
From: Filip Kastl @ 2023-02-15 10:16 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:93022729bb73c47a219b4351614e76f3bf0d93a5

commit 93022729bb73c47a219b4351614e76f3bf0d93a5
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:[~2023-02-15 10:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 10:16 [gcc(refs/users/pheeck/heads/sccp)] libcpp/remap: Only override if string matched Filip Kastl

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).