On 08/12/2016 07:18 PM, Eric Botcazou wrote:
2016-07-30 Andris Pavenis <andris.pave...@iki.fi>

      * 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): support DJGPP special
paths (/dev/*) for DJGPP hosts
The patch does more than this though:
Updated ChangeLog entry:

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): support DJGPP special paths (/dev/*) 
for DJGPP hosts,
     (Normalize_Pathname): do not convert '/' to '\' for DJGPP hosts.



@@ -2242,8 +2271,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;

Why does DJGPP need to be special-cased here?  In order to disable some
further transformation downstream?  Could DIR_SEPARATOR be just '/'?

Both '/' and '\' must be supported as directory separators. So DIR_SEPARATOR='/' is not OK in this case.

Unconditional converting '/' to '\' in case of DJGPP native build causes gnatmake to break. Retested it today it with gcc-6.1.0. The problem is that special directory name /dev/env/DJDIR is used as prefix for DJGPP (it resolves to $DJDIR in execution time)

Andris

PS. Maybe it could be nicer if Normalize_Pathname would be in a separate package. This way one could override it for all targets for which special handling is needed.





Reply via email to