From patchwork Wed Aug 17 04:26:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Andris_Pav=C4=93nis?= X-Patchwork-Id: 659895 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sDbm60jcmz9t1F for ; Wed, 17 Aug 2016 14:27:01 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=u1MJA1nP; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=YxkFuzZL5BWwsgubV xgChbef0eEuNhBz9uv72mkbsd22MUpo9w376Aokui0uRN9hnaqbw3VXhB8XEg58O vwzWYnOCL7el42WePyA/jxUG2c2cPTRh65Xt9NMN5TUfku1NpOE+h3PDSmbPJqyu O/v9BmVTDzmYkgwcacmhp1QWLw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=B8b7SCG6tpjmkOROuB+gbpC u70U=; b=u1MJA1nPMTqvesYo/fPoHVBGXhcu5cyWIH8H33IEm2yfx1kdEFCp2Tb +rbOCej3I+W4n4b+AHB+7KTnsvOLtXfdPxm/GlG68buDn0WVsiZpPj7btIAFHxmO 0rDpx3y2jHNnISttQoeTJf41RRFta7Uxiv7NjlcKrm3jpRtcwkMo= Received: (qmail 127582 invoked by alias); 17 Aug 2016 04:26:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 127570 invoked by uid 89); 17 Aug 2016 04:26:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy=H*F:D*fi, D*fi, study, letter X-HELO: julia1.inet.fi Received: from mta-out1.inet.fi (HELO julia1.inet.fi) (62.71.2.232) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Aug 2016 04:26:42 +0000 Received: from ap.localhost.localdomain (80.223.182.110) by julia1.inet.fi (9.0.002.03-2-gbe5d057) (authenticated as pavean-2) id 5782991C00DF7E4D; Wed, 17 Aug 2016 07:25:32 +0300 Subject: Re: [PATCH 1/4][Ada,DJGPP] Ada support for DJGPP To: Eric Botcazou References: <1b9dbcb4-484a-6f4c-766a-fda3b34d33a3@iki.fi> <4772546.99ocXJHpAR@arcturus.home> <2736336.021dZUVuNF@arcturus.home> Cc: gcc-patches@gcc.gnu.org, DJ Delorie From: Andris Pavenis Message-ID: <0c9adcbe-e2ca-1708-e634-3625c0644bc3@iki.fi> Date: Wed, 17 Aug 2016 07:26:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <2736336.021dZUVuNF@arcturus.home> 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 Pavenis 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(-) 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