diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-09-10 11:31:02 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-09-10 11:31:02 +0200 |
commit | e5dc610e6dd4695349a09d02e923ac6b45ba0cbb (patch) | |
tree | e76c03390d624bc43460270253077c503970e322 /gcc/ada/prj-util.adb | |
parent | 2bc58d4d59d22e8e8dacd5ab60d802e32fd2954c (diff) | |
download | gcc-e5dc610e6dd4695349a09d02e923ac6b45ba0cbb.zip gcc-e5dc610e6dd4695349a09d02e923ac6b45ba0cbb.tar.gz gcc-e5dc610e6dd4695349a09d02e923ac6b45ba0cbb.tar.bz2 |
[multiple changes]
2010-09-10 Robert Dewar <dewar@adacore.com>
* g-pehage.ads: Minor reformatting
* gnat_ugn.texi: Clarifying comment on -gnatyc
* exp_ch6.adb (Expand_N_Subprogram_Body): Reset Is_Pure if limited
arguments.
2010-09-10 Tristan Gingold <gingold@adacore.com>
* Make-generated.in (gnat.hlp): New rule.
2010-09-10 Emmanuel Briot <briot@adacore.com>
* prj-util.adb, prj-util.ads (Executable_Of): New parameter
Include_Suffix.
From-SVN: r164146
Diffstat (limited to 'gcc/ada/prj-util.adb')
-rw-r--r-- | gcc/ada/prj-util.adb | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb index 159ee83..76387b7 100644 --- a/gcc/ada/prj-util.adb +++ b/gcc/ada/prj-util.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2010, 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- -- @@ -105,12 +105,13 @@ package body Prj.Util is ------------------- function Executable_Of - (Project : Project_Id; - In_Tree : Project_Tree_Ref; - Main : File_Name_Type; - Index : Int; - Ada_Main : Boolean := True; - Language : String := "") return File_Name_Type + (Project : Project_Id; + In_Tree : Project_Tree_Ref; + Main : File_Name_Type; + Index : Int; + Ada_Main : Boolean := True; + Language : String := ""; + Include_Suffix : Boolean := True) return File_Name_Type is pragma Assert (Project /= No_Project); @@ -145,6 +146,10 @@ package body Prj.Util is S_Suffix : File_Name_Type); -- Get the non empty suffixes in variables Spec_Suffix and Body_Suffix + function Add_Suffix (File : File_Name_Type) return File_Name_Type; + -- Return the name of the executable, based on File, and adding the + -- executable suffix if needed. + ------------------ -- Get_Suffixes -- ------------------ @@ -165,6 +170,29 @@ package body Prj.Util is end if; end Get_Suffixes; + ---------------- + -- Add_Suffix -- + ---------------- + + function Add_Suffix (File : File_Name_Type) return File_Name_Type is + Saved_EEOT : constant Name_Id := Executable_Extension_On_Target; + Result : File_Name_Type; + + begin + if Include_Suffix then + if Executable_Suffix_Name /= No_Name then + Executable_Extension_On_Target := Executable_Suffix_Name; + end if; + + Result := Executable_Name (File_Name_Type (Executable.Value)); + Executable_Extension_On_Target := Saved_EEOT; + return Result; + + else + return File; + end if; + end Add_Suffix; + -- Start of processing for Executable_Of begin @@ -237,22 +265,7 @@ package body Prj.Util is and then Executable.Value /= No_Name and then Length_Of_Name (Executable.Value) /= 0 then - -- Get the executable name. If Executable_Suffix is defined, - -- make sure that it will be the extension of the executable. - - declare - Saved_EEOT : constant Name_Id := Executable_Extension_On_Target; - Result : File_Name_Type; - - begin - if Executable_Suffix_Name /= No_Name then - Executable_Extension_On_Target := Executable_Suffix_Name; - end if; - - Result := Executable_Name (File_Name_Type (Executable.Value)); - Executable_Extension_On_Target := Saved_EEOT; - return Result; - end; + return Add_Suffix (File_Name_Type (Executable.Value)); end if; end if; @@ -287,24 +300,7 @@ package body Prj.Util is Get_Name_String (Strip_Suffix (Main)); end if; - -- Get the executable name. If Executable_Suffix is defined in the - -- configuration, make sure that it will be the extension of the - -- executable. - - declare - Saved_EEOT : constant Name_Id := Executable_Extension_On_Target; - Result : File_Name_Type; - - begin - if Project.Config.Executable_Suffix /= No_Name then - Executable_Extension_On_Target := - Project.Config.Executable_Suffix; - end if; - - Result := Executable_Name (Name_Find); - Executable_Extension_On_Target := Saved_EEOT; - return Result; - end; + return Add_Suffix (Name_Find); end Executable_Of; -------------- |