aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDmitriy Anisimkov <anisimko@adacore.com>2020-01-23 12:38:47 +0600
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-04 05:11:03 -0400
commit7c02e403d145989ed9f291123689baa96f455fb5 (patch)
tree0cf8480459ac6e49586245d3c2f75fc69ae94f77 /gcc
parent51bc44b84aafd0bbdcd6cacfbbe2d20f5a15df6a (diff)
downloadgcc-7c02e403d145989ed9f291123689baa96f455fb5.zip
gcc-7c02e403d145989ed9f291123689baa96f455fb5.tar.gz
gcc-7c02e403d145989ed9f291123689baa96f455fb5.tar.bz2
[Ada] Fix Is_Absolute_Path on Windows
2020-06-04 Dmitriy Anisimkov <anisimko@adacore.com> gcc/ada/ * adaint.c (__gnat_is_absolute_path): Check for directory separator after drive and colon. (IS_DIR_SEPARATOR): Define new inline substitution.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/adaint.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index f3d4d65..a499200 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -264,6 +264,9 @@ UINT __gnat_current_ccs_encoding;
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
+#define IS_DIR_SEPARATOR(c) ((c) == DIR_SEPARATOR)
+#else
+#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == DIR_SEPARATOR)
#endif
/* Check for cross-compilation. */
@@ -1709,9 +1712,10 @@ __gnat_is_absolute_path (char *name, int length)
return 0;
#else
return (length != 0) &&
- (*name == '/' || *name == DIR_SEPARATOR
+ (IS_DIR_SEPARATOR(*name)
#if defined (WINNT) || defined(__DJGPP__)
- || (length > 1 && ISALPHA (name[0]) && name[1] == ':')
+ || (length > 2 && ISALPHA (name[0]) && name[1] == ':'
+ && IS_DIR_SEPARATOR(name[2]))
#endif
);
#endif
@@ -2845,7 +2849,7 @@ __gnat_locate_file_with_predicate (char *file_name, char *path_val,
/* If file_name include directory separator(s), try it first as
a path name relative to the current directory */
- for (ptr = file_name; *ptr && *ptr != '/' && *ptr != DIR_SEPARATOR; ptr++)
+ for (ptr = file_name; *ptr && !IS_DIR_SEPARATOR(*ptr); ptr++)
;
if (*ptr != 0)
@@ -2886,7 +2890,7 @@ __gnat_locate_file_with_predicate (char *file_name, char *path_val,
if (*ptr == '"')
ptr--;
- if (*ptr != '/' && *ptr != DIR_SEPARATOR)
+ if (!IS_DIR_SEPARATOR(*ptr))
*++ptr = DIR_SEPARATOR;
strcpy (++ptr, file_name);