This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: include path on windows


"Danny Smith" <dansmister@gmail.com> writes:

> libcpp/ChangeLog
> 	* include/cpplib.h (struct cpp_dir): Add new field, canonical_name.
>
> gcc/ChangeLog
>
> 	* c-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.

> +  /* The canonicalized NAME as determined by lrealpath.  */
> +  char* canonical_name;

Please expand the comment to say that this field is only used on hosts
which don't have reliable inode values.


>  #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

I believe this changes the behaviour on cygwin.  cygwin does not
appear to define HOST_LACKS_INODE_NUMBERS, but I believe that it
formerly would not define INO_T_EQ.  Are cygwin inode numbers
sufficiently reliable that they can be compared for equality?


>  static const char dir_separator_str[] = { DIR_SEPARATOR, 0 };
> @@ -388,7 +388,7 @@
>  void
>  add_path (char *path, int chain, int cxx_aware, bool user_supplied_p)
>  {
> -  cpp_dir *p;
> +  cpp_dir *p = XNEW (cpp_dir);
>  
>  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
>    /* Remove unnecessary trailing slashes.  On some versions of MS
> @@ -405,9 +405,11 @@
>      *end = 0;
>  #endif
>  
> -  p = XNEW (cpp_dir);

Moving the XNEW call sems to be unnecessary and it's not my preferred
style.  I think it's better to keep the initialization at the right
point in the code.

The patch is OK with those changes if you can promise that it will
work correctly on cygwin.

Thanks.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]