From patchwork Mon Jul 30 15:18:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 174031 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]) by ozlabs.org (Postfix) with SMTP id 0A00A2C0086 for ; Tue, 31 Jul 2012 01:18:47 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1344266328; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=QpA+M746qmJXjfaTCy4G rLpgrWA=; b=TSLxqov4xiiDPUc4mBdzYqpwC7AQSIZqVfQMWIaHscxVmtxxBtaB Kg7fOSiMdgfMbPXsrnhEbx0X9UFraC6qyoB/tdDcehX6Lgega0Byu6HE+VvCWxTb 3mHVzdcefmFS/1hucONfc2YhUDc1pu/QsJ0VURoKGH99G5IV+ovxGFE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=qXtPiIqOeOQNMYBSz4Kh+dMFcLT9ghJMR6EDj/HEF8lD4zyA7o79TUY7BK26QS 9CeB0nblECnT0QkUEks1x6+gfFngSUWmbAJQ2ZOh0mYtq6ms+DB7ek3y5ca2R1RZ NL+mJiutOD2j1UfF/zbEZeEF/HhyBJdr2mlOJ00nGWbLE=; Received: (qmail 18283 invoked by alias); 30 Jul 2012 15:18:38 -0000 Received: (qmail 18260 invoked by uid 22791); 30 Jul 2012 15:18:35 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Jul 2012 15:18:17 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A36AA1C74C5; Mon, 30 Jul 2012 11:18:15 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MHNSXvQZlzHS; Mon, 30 Jul 2012 11:18:15 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 7FE7D1C74B2; Mon, 30 Jul 2012 11:18:15 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 7404192BF6; Mon, 30 Jul 2012 11:18:15 -0400 (EDT) Date: Mon, 30 Jul 2012 11:18:15 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Thomas Quinot Subject: [Ada] Fix handling of -A binder argument by gnatmake Message-ID: <20120730151815.GA17502@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 This change fixes the circuitry that passes binder flags from gnatmake: for some switches, relative path arguments are changed to absolute paths. However, for gnatbind the -A switch must not undergo this transformation. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-07-30 Thomas Quinot * gnatcmd.adb, make.adb, makeutl.adb, makeutl.ads (Test_If_Relative_Path): Rename to Ensure_Absolute_Path to better reflect what this subprogram does. Rename argument Including_L_Switch to For_Gnatbind, and also exempt -A from rewriting. * bindusg.adb: Document optional =file argument to gnatbind -A. Index: bindusg.adb =================================================================== --- bindusg.adb (revision 189974) +++ bindusg.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -78,7 +78,7 @@ -- Line for -A switch - Write_Line (" -A Give list of ALI files in partition"); + Write_Line (" -A[=file] Give list of ALI files in partition"); -- Line for -b switch Index: gnatcmd.adb =================================================================== --- gnatcmd.adb (revision 189974) +++ gnatcmd.adb (working copy) @@ -273,7 +273,7 @@ -- Add the -L and -l switches to the linker for all of the library -- projects. - procedure Test_If_Relative_Path + procedure Ensure_Absolute_Path (Switch : in out String_Access; Parent : String); -- Test if Switch is a relative search path switch. If it is and it @@ -1303,20 +1303,20 @@ end Set_Library_For; --------------------------- - -- Test_If_Relative_Path -- + -- Ensure_Absolute_Path -- --------------------------- - procedure Test_If_Relative_Path + procedure Ensure_Absolute_Path (Switch : in out String_Access; Parent : String) is begin - Makeutl.Test_If_Relative_Path + Makeutl.Ensure_Absolute_Path (Switch, Parent, Do_Fail => Osint.Fail'Access, Including_Non_Switch => False, Including_RTS => True); - end Test_If_Relative_Path; + end Ensure_Absolute_Path; ------------------- -- Non_VMS_Usage -- @@ -2387,7 +2387,7 @@ -- arguments. for J in 1 .. Last_Switches.Last loop - GNATCmd.Test_If_Relative_Path + GNATCmd.Ensure_Absolute_Path (Last_Switches.Table (J), Current_Work_Dir); end loop; @@ -2397,7 +2397,7 @@ Project_Dir : constant String := Name_Buffer (1 .. Name_Len); begin for J in 1 .. First_Switches.Last loop - GNATCmd.Test_If_Relative_Path + GNATCmd.Ensure_Absolute_Path (First_Switches.Table (J), Project_Dir); end loop; end; Index: make.adb =================================================================== --- make.adb (revision 189974) +++ make.adb (working copy) @@ -2366,7 +2366,7 @@ Last_New := Last_New + 1; New_Args (Last_New) := new String'(Name_Buffer (1 .. Name_Len)); - Test_If_Relative_Path + Ensure_Absolute_Path (New_Args (Last_New), Do_Fail => Make_Failed'Access, Parent => Dir_Path, @@ -2399,7 +2399,7 @@ Directory.Display_Name); begin - Test_If_Relative_Path + Ensure_Absolute_Path (New_Args (1), Do_Fail => Make_Failed'Access, Parent => Dir_Path, @@ -5028,36 +5028,36 @@ Get_Name_String (Main_Project.Directory.Display_Name); begin for J in 1 .. Binder_Switches.Last loop - Test_If_Relative_Path + Ensure_Absolute_Path (Binder_Switches.Table (J), Do_Fail => Make_Failed'Access, - Parent => Dir_Path, Including_L_Switch => False); + Parent => Dir_Path, For_Gnatbind => True); end loop; for J in 1 .. Saved_Binder_Switches.Last loop - Test_If_Relative_Path + Ensure_Absolute_Path (Saved_Binder_Switches.Table (J), - Do_Fail => Make_Failed'Access, - Parent => Current_Work_Dir, - Including_L_Switch => False); + Do_Fail => Make_Failed'Access, + Parent => Current_Work_Dir, + For_Gnatbind => True); end loop; for J in 1 .. Linker_Switches.Last loop - Test_If_Relative_Path + Ensure_Absolute_Path (Linker_Switches.Table (J), Parent => Dir_Path, Do_Fail => Make_Failed'Access); end loop; for J in 1 .. Saved_Linker_Switches.Last loop - Test_If_Relative_Path + Ensure_Absolute_Path (Saved_Linker_Switches.Table (J), Do_Fail => Make_Failed'Access, Parent => Current_Work_Dir); end loop; for J in 1 .. Gcc_Switches.Last loop - Test_If_Relative_Path + Ensure_Absolute_Path (Gcc_Switches.Table (J), Do_Fail => Make_Failed'Access, Parent => Dir_Path, @@ -5065,7 +5065,7 @@ end loop; for J in 1 .. Saved_Gcc_Switches.Last loop - Test_If_Relative_Path + Ensure_Absolute_Path (Saved_Gcc_Switches.Table (J), Parent => Current_Work_Dir, Do_Fail => Make_Failed'Access, @@ -5387,14 +5387,14 @@ Get_Name_String (Main_Project.Directory.Display_Name); begin for J in Last_Binder_Switch + 1 .. Binder_Switches.Last loop - Test_If_Relative_Path + Ensure_Absolute_Path (Binder_Switches.Table (J), Do_Fail => Make_Failed'Access, - Parent => Dir_Path, Including_L_Switch => False); + Parent => Dir_Path, For_Gnatbind => True); end loop; for J in Last_Linker_Switch + 1 .. Linker_Switches.Last loop - Test_If_Relative_Path + Ensure_Absolute_Path (Linker_Switches.Table (J), Parent => Dir_Path, Do_Fail => Make_Failed'Access); Index: makeutl.adb =================================================================== --- makeutl.adb (revision 189974) +++ makeutl.adb (working copy) @@ -1316,11 +1316,12 @@ -- Object files and -L switches specified with relative -- paths must be converted to absolute paths. - Test_If_Relative_Path - (Switch => Linker_Options_Buffer (Last_Linker_Option), - Parent => Dir_Path, - Do_Fail => Do_Fail, - Including_L_Switch => True); + Ensure_Absolute_Path + (Switch => + Linker_Options_Buffer (Last_Linker_Option), + Parent => Dir_Path, + Do_Fail => Do_Fail, + For_Gnatbind => False); end if; Options := In_Tree.Shared.String_Elements.Table (Options).Next; @@ -1936,14 +1937,14 @@ end Path_Or_File_Name; --------------------------- - -- Test_If_Relative_Path -- + -- Ensure_Absolute_Path -- --------------------------- - procedure Test_If_Relative_Path + procedure Ensure_Absolute_Path (Switch : in out String_Access; Parent : String; Do_Fail : Fail_Proc; - Including_L_Switch : Boolean := True; + For_Gnatbind : Boolean := False; Including_Non_Switch : Boolean := True; Including_RTS : Boolean := False) is @@ -1958,9 +1959,10 @@ if Sw (1) = '-' then if Sw'Length >= 3 - and then (Sw (2) = 'A' - or else Sw (2) = 'I' - or else (Including_L_Switch and then Sw (2) = 'L')) + and then (Sw (2) = 'I' + or else (not For_Gnatbind + and then (Sw (2) = 'L' + or else Sw (2) = 'A'))) then Start := 3; @@ -1973,7 +1975,9 @@ or else Sw (2 .. 3) = "aO" or else - Sw (2 .. 3) = "aI") + Sw (2 .. 3) = "aI" + or else + (For_Gnatbind and then Sw (2 .. 3) = "A=")) then Start := 4; @@ -2033,7 +2037,7 @@ end if; end; end if; - end Test_If_Relative_Path; + end Ensure_Absolute_Path; ------------------- -- Unit_Index_Of -- Index: makeutl.ads =================================================================== --- makeutl.ads (revision 189974) +++ makeutl.ads (working copy) @@ -235,20 +235,19 @@ -- Find the index of a unit in a source file. Return zero if the file is -- not a multi-unit source file. - procedure Test_If_Relative_Path + procedure Ensure_Absolute_Path (Switch : in out String_Access; Parent : String; Do_Fail : Fail_Proc; - Including_L_Switch : Boolean := True; + For_Gnatbind : Boolean := False; Including_Non_Switch : Boolean := True; Including_RTS : Boolean := False); - -- Test if Switch is a relative search path switch. If so, fail if Parent - -- is the empty string, otherwise prepend the path with Parent. This - -- subprogram is only used when using project files. For gnatbind switches, - -- Including_L_Switch is False, because the argument of the -L switch is - -- not a path. If Including_RTS is True, process also switches --RTS=. - -- Do_Fail is called in case of error. Using Osint.Fail might be - -- appropriate. + -- Do nothing if Switch is an absolute path switch. If relative, fail if + -- Parent is the empty string, otherwise prepend the path with Parent. This + -- subprogram is only used when using project files. If For_Gnatbind is + -- True, gnatbind switches that are not paths (-L, -A) are left unchaned. + -- If Including_RTS is True, process also switches --RTS=. Do_Fail is + -- called in case of error. Using Osint.Fail might be appropriate. function Path_Or_File_Name (Path : Path_Name_Type) return String; -- Returns a file name if -df is used, otherwise return a path name