Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
On 08/15/2016 11:27 AM, Eric Botcazou wrote: Both '/' and '\' must be supported as directory separators. So DIR_SEPARATOR='/' is not OK in this case. Understood. 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) So it's only because of the /dev/ thing, i.e. this would work without it? If so, can we restrict the special-casing to this block of code? -- Replace all '/' by Directory Separators (this is for Windows) if Directory_Separator /= '/' then for Index in 1 .. End_Path loop if Path_Buffer (Index) = '/' then Path_Buffer (Index) := Directory_Separator; end if; end loop; end if; IOW, can we disable it for the /dev/ thing and leave the rest untouched? Since DIR_SEPARATOR=='\', the block immediately below will be disabled too. Some more study shows that smaller patch (attached) is sufficient. There is no harm from pre-pending drive letter (like 'c:'). Specifying '\dev\' do not however work. Disabling conversion for '/dev/' alone would influence Windows port as such directory name is OK for Windows. Updated changelog entry is inside the attachment. Andris >From d746c4fa913a2eca6f1d93b614fd0aa908cfd13a Mon Sep 17 00:00:00 2001 From: Andris PavenisDate: 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(-) diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index e011fef..f317865 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -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 diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb index 31b2f08..21173db 100644 --- a/gcc/ada/s-os_lib.adb +++ b/gcc/ada/s-os_lib.adb @@ -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; diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads index 9004874..5c8bfe2 100644 --- a/gcc/ada/s-os_lib.ads +++ b/gcc/ada/s-os_lib.ads @@ -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
Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
> Both '/' and '\' must be supported as directory separators. So > DIR_SEPARATOR='/' is not OK in this case. Understood. > 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) So it's only because of the /dev/ thing, i.e. this would work without it? If so, can we restrict the special-casing to this block of code? -- Replace all '/' by Directory Separators (this is for Windows) if Directory_Separator /= '/' then for Index in 1 .. End_Path loop if Path_Buffer (Index) = '/' then Path_Buffer (Index) := Directory_Separator; end if; end loop; end if; IOW, can we disable it for the /dev/ thing and leave the rest untouched? Since DIR_SEPARATOR=='\', the block immediately below will be disabled too. -- Eric Botcazou
Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
>>> * 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) This part of the patch is really too kludgy and too intrusive, you will need to find find a less intrusive way to address this djgpp special case. Arno
Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
On 08/12/2016 07:18 PM, Eric Botcazou wrote: 2016-07-30 Andris Pavenis* 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.
Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
> 2016-07-30 Andris Pavenis> > * 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: @@ -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 '/'? -- Eric Botcazou
Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
On 07/31/2016 10:57 AM, Arnaud Charlet wrote: Frankly at this stage, I do not think it makes sense to maintain an Ada port for DJGPP and in particular maintain all these extra special cases and #ifdefs. I don't think this is a reasonable attitude to take with people who are willing to do the work to do it. OK, let me reformulate my comments and questions then: - can you (Andris) clarify what usage you are/will be doing with this port? I'm providing packages of DJGPP port of GCC already since gcc-2.8.1 including also Ada compiler since gcc-3.2. Required changes were maintained outside official GCC source tree for a long time. That required both merge conflicts and port breakages to be handled due to upstream sources development related changes. I myself am not using Ada otherwise. As result It is difficult to say how many are actually using it as everybody who wants it can freely download binary packages from DJGPP distribution. At least related asking in DJGPP mailing list showed that the number is not 0. One do not however need to subscribed to that list to download and use packages. Also amount of changes required for port of Ada compiler was considerably decreased since dropping support of old DJGPP v.203. - are you volunterring to regularly test this port and maintain it I have already done it with changes outside official source tree for a rather long time. Having changes in will make this maintenance easier. (e.g. fix breakage) "Doing the work" isn't a one shot thing, it's a long term commitment, so it better be worth it as you said yourself. Andris
Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
> > Frankly at this stage, I do not think it makes sense to maintain an > > Ada port for DJGPP and in particular maintain all these extra > > special cases and #ifdefs. > > I don't think this is a reasonable attitude to take with people who > are willing to do the work to do it. OK, let me reformulate my comments and questions then: - can you (Andris) clarify what usage you are/will be doing with this port? - are you volunterring to regularly test this port and maintain it (e.g. fix breakage) "Doing the work" isn't a one shot thing, it's a long term commitment, so it better be worth it as you said yourself. Arno
Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
> Frankly at this stage, I do not think it makes sense to maintain an > Ada port for DJGPP and in particular maintain all these extra > special cases and #ifdefs. I don't think this is a reasonable attitude to take with people who are willing to do the work to do it. Frankly, I'd like to take Ada out of gcc completely - after all, *I* don't use it, and it's a huge amount of overhead that I have to deal with all the time. But I recognize that others benefit from, and are willing to maintain, the Ada front-end. You should allow others to maintain DJGPP ports for it. > How many users are we talking about here? Zero if you reject the patches, of course.
Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP
Frankly at this stage, I do not think it makes sense to maintain an Ada port for DJGPP and in particular maintain all these extra special cases and #ifdefs. How many users are we talking about here? Arno > This is first of 4 patches for DJGPP support of Ada compiler > > Patch adds support of handling DJGPP special paths which do not follow normal > DOS file-name rules. > > Some details about handled DJGPP special pathnames: for example '/dev/c/foo' > is interpreted as 'c:/foo', '/dev/env/DJDIR/include' is interpreted as > $DJDIR/include. Adding drive prefix (like c:/dev/c/foo) is not supported for > these special path-names. > > ChangeLog entry: > > 2016-07-30 Andris Pavenis> >* 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 > > Andris > > > > <0001-DJGPP-Ada-File-path-handling-for-DJGPP-host.patch>