From c100de59ebf2f118ce0757c475b078b6f62d4017 Mon Sep 17 00:00:00 2001
From: Danny Smith <dannysmith@users.sourceforge.net>
Date: Fri, 30 May 2008 00:57:56 +0000
Subject: [PATCH] cpplib.h (struct cpp_dir): Add new field, canonical_name.

libcpp/ChangeLog
	* include/cpplib.h (struct cpp_dir): Add new field, canonical_name.

gcc/ChangeLog

	* incpath.c: Use HOST_LACKS_INODE_NUMBERS conditional
	rather than OS names to choose INO_T_EQ definition.
	(DIRS_EQ) [!INO_T_EQ]: Don't worry about case in comparison.
	(add_path) [!INO_T_EQ]: Use lrealpath to fill canonical_name field.

From-SVN: r136196
---
 gcc/ChangeLog           |  8 ++++++++
 gcc/incpath.c           | 10 ++++++----
 libcpp/ChangeLog        |  4 ++++
 libcpp/include/cpplib.h |  4 ++++
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f4c3f5e0c2f5..aeff771692be 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-30  Danny Smith  <dannysmith@users.sourceforge.net>
+
+	* incpath.c: Use HOST_LACKS_INODE_NUMBERS conditional
+	rather than OS names to choose INO_T_EQ definition.
+	(DIRS_EQ) [!INO_T_EQ]: Don't worry about case in comparison.
+	(add_path) [!INO_T_EQ]: Use lrealpath to fill canonical_name
+	field.
+
 2008-05-29  Daniel Franke  <franke.daniel@gmail.com>
 
 	PR target/36348
diff --git a/gcc/incpath.c b/gcc/incpath.c
index e5fe8db23ca8..761b1cf63059 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
@@ -31,13 +31,12 @@
 #include "incpath.h"
 #include "cppdefault.h"
 
-/* Windows does not natively support inodes, and neither does MSDOS.
-   Cygwin's emulation can generate non-unique inodes, so don't use it.
+/* Microsoft Windows does not natively support inodes.
    VMS has non-numeric inodes.  */
 #ifdef VMS
 # define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A)))
 # define INO_T_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof (SRC))
-#elif !((defined _WIN32 && !defined (_UWIN)) || defined __MSDOS__)
+#elif !defined (HOST_LACKS_INODE_NUMBERS)
 # define INO_T_EQ(A, B) ((A) == (B))
 # define INO_T_COPY(DEST, SRC) (DEST) = (SRC)
 #endif
@@ -46,7 +45,7 @@
 #define DIRS_EQ(A, B) ((A)->dev == (B)->dev \
 	&& INO_T_EQ((A)->ino, (B)->ino))
 #else
-#define DIRS_EQ(A, B) (!strcasecmp ((A)->name, (B)->name))
+#define DIRS_EQ(A, B) (!strcmp ((A)->canonical_name, (B)->canonical_name))
 #endif
 
 static const char dir_separator_str[] = { DIR_SEPARATOR, 0 };
@@ -408,6 +407,9 @@ add_path (char *path, int chain, int cxx_aware, bool user_supplied_p)
   p = XNEW (cpp_dir);
   p->next = NULL;
   p->name = path;
+#ifndef INO_T_EQ
+  p->canonical_name = lrealpath (path);
+#endif
   if (chain == SYSTEM || chain == AFTER)
     p->sysp = 1 + !cxx_aware;
   else
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 7f31ff4e79a8..6df683eee916 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,7 @@
+2008-05-30  Danny Smith  <dannysmith@users.sourceforge.net>
+
+	* include/cpplib.h (struct cpp_dir): Add new field, canonical_name.
+
 2008-05-21  Tom Tromey  <tromey@redhat.com>
 
 	PR preprocessor/27777:
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 76288a9068cf..92ab291db2cd 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -508,6 +508,10 @@ struct cpp_dir
   char *name;
   unsigned int len;
 
+  /* The canonicalized NAME as determined by lrealpath.  This field 
+     is only used by hosts that lack reliable inode numbers.  */
+  char *canonical_name;
+
   /* One if a system header, two if a system header that has extern
      "C" guards for C++.  */
   unsigned char sysp;
-- 
GitLab