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: [patch/libiberty] IS_ABSOLUTE_PATH to handle both DOS and POS IX p ath styles


> > +#define IS_ABSOLUTE_PATH_DOS(f)	  (((f)[0]) && ((f)[1] == ':'))
> 
> Amusingly enough, this is wrong.  

I simply followed existing logic. In the code it says:

#define IS_DIR_SEPARATOR(c)     ((c) == '/' || (c) == '\\')
/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is
   only semi-absolute.  This is because the users of IS_ABSOLUTE_PATH
   want to know whether to prepend the current working directory to
   a file name, which should not be done with a name like d:foo.  */
#define IS_ABSOLUTE_PATH(f)     (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) &&
((f)[1] == ':'))) 

Strictly speaking it is not correct, but the macros are used to determine
whether a path can be treated as an absolute or not. To be 100% correct it
would be, as you say, tricky.
_X(f)	  (IS_DIR_SEPARATOR_X((f)[0]))
> 
> Why X and not POSIX?  The X window system doesn't define any path
> separators.
No good reason. It was shorter I guess.

Thanks,
Aleksandar 


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