From d746c4fa913a2eca6f1d93b614fd0aa908cfd13a Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pavenis@iki.fi>
Date: Tue, 16 Aug 2016 06:15:57 +0300
Subject: [PATCH 1/4] [DJGPP, Ada] File path handling for DJGPP host
* ada/adaint.c (__gnat_is_djgpp): define (1 for DJGPP host, 0 otherwise).
* ada/s-os_lib.ads (Is_Djgpp): import __gnat_is_djgpp as constant.
* ada/s-os_lib.adb (Normalize_Pathname): do not convert '/' to '\' for DJGPP host
---
gcc/ada/adaint.c | 6 ++++++
gcc/ada/s-os_lib.adb | 5 ++++-
gcc/ada/s-os_lib.ads | 3 +++
3 files changed, 13 insertions(+), 1 deletion(-)
@@ -226,6 +226,12 @@ char __gnat_dir_separator = DIR_SEPARATOR;
char __gnat_path_separator = PATH_SEPARATOR;
+#ifdef __DJGPP__
+int __gnat_is_djgpp = 1;
+#else
+int __gnat_is_djgpp = 0;
+#endif
+
/* The GNAT_LIBRARY_TEMPLATE contains a list of expressions that define
the base filenames that libraries specified with -lsomelib options
may have. This is used by GNATMAKE to check whether an executable
@@ -2242,8 +2242,11 @@ package body System.OS_Lib is
end File_Name_Conversion;
-- Replace all '/' by Directory Separators (this is for Windows)
+ -- No need to do that however for DJGPP
- if Directory_Separator /= '/' then
+ if Directory_Separator /= '/'
+ and then Is_Djgpp = 0
+ then
for Index in 1 .. End_Path loop
if Path_Buffer (Index) = '/' then
Path_Buffer (Index) := Directory_Separator;
@@ -1068,9 +1068,12 @@ package System.OS_Lib is
Path_Separator : constant Character;
-- The character to separate paths in an environment variable value
+ Is_Djgpp : constant Integer;
+
private
pragma Import (C, Path_Separator, "__gnat_path_separator");
pragma Import (C, Directory_Separator, "__gnat_dir_separator");
+ pragma Import (C, Is_Djgpp, "__gnat_is_djgpp");
pragma Import (C, Current_Time, "__gnat_current_time");
pragma Import (C, Current_Process_Id, "__gnat_current_process_id");
--
2.7.4