summaryrefslogtreecommitdiff
path: root/gcc/ada/prj-util.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-25 09:26:07 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-25 09:26:07 +0000
commit77378d518eb62788e2f759abb1a87a66dfafabaf (patch)
tree116462c37d01ba1b6c932ed55b7db566a03c056d /gcc/ada/prj-util.adb
parent703cfbf8e933ced3dc6df60732afddc46441db02 (diff)
downloadgcc-77378d518eb62788e2f759abb1a87a66dfafabaf.tar.gz
2009-06-25 Emmanuel Briot <briot@adacore.com>
* gnatcmd.adb, prj-proc.adb, make.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-util.adb, prj-env.adb, prj-env.ads: Merge handling of naming_data between gnatmake and gprbuild. (Naming_Data): Removed, no longer used (Naming_Table, Project_Tree_Ref.Namings): Removed, since this is only needed locally in one subprogram, no need to store forever in the structure. (Check_Naming_Scheme, Check_Package_Naming): Merged, since they play a similar role. (Body_Suffix_Of, Body_Suffix_Id_Of, Register_Default_Naming_Scheme, Same_Naming_Scheme, Set_Body_Suffix, Set_Spec_Suffix, Spec_Suffix_Of, Spec_Suffix_Id_Of): removed, no longer used. 2009-06-25 Javier Miranda <miranda@adacore.com> * sem_res.adb (Resolve_Allocator): Skip test requiring exact match of types on qualified expression in calls to imported C++ constructors. * exp_ch4.adb (Expand_Allocator_Expression): Add missing support for imported C++ constructors. 2009-06-25 Sergey Rybin <rybin@adacore.com> * vms_data.ads: Add qualifier for new gnatcheck '-t' option. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148937 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/prj-util.adb')
-rw-r--r--gcc/ada/prj-util.adb45
1 files changed, 22 insertions, 23 deletions
diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb
index cd7696fdfed..5e36fcd71e6 100644
--- a/gcc/ada/prj-util.adb
+++ b/gcc/ada/prj-util.adb
@@ -134,7 +134,7 @@ package body Prj.Util is
Executable_Suffix_Name : Name_Id := No_Name;
- Naming : constant Naming_Data := Project.Naming;
+ Lang : Language_Ptr;
Spec_Suffix : Name_Id := No_Name;
Body_Suffix : Name_Id := No_Name;
@@ -143,8 +143,8 @@ package body Prj.Util is
Body_Suffix_Length : Natural := 0;
procedure Get_Suffixes
- (B_Suffix : String;
- S_Suffix : String);
+ (B_Suffix : File_Name_Type;
+ S_Suffix : File_Name_Type);
-- Get the non empty suffixes in variables Spec_Suffix and Body_Suffix
------------------
@@ -152,22 +152,18 @@ package body Prj.Util is
------------------
procedure Get_Suffixes
- (B_Suffix : String;
- S_Suffix : String)
+ (B_Suffix : File_Name_Type;
+ S_Suffix : File_Name_Type)
is
begin
- if B_Suffix'Length > 0 then
- Name_Len := B_Suffix'Length;
- Name_Buffer (1 .. Name_Len) := B_Suffix;
- Body_Suffix := Name_Find;
- Body_Suffix_Length := B_Suffix'Length;
+ if B_Suffix /= No_File then
+ Body_Suffix := Name_Id (B_Suffix);
+ Body_Suffix_Length := Natural (Length_Of_Name (Body_Suffix));
end if;
- if S_Suffix'Length > 0 then
- Name_Len := S_Suffix'Length;
- Name_Buffer (1 .. Name_Len) := S_Suffix;
- Spec_Suffix := Name_Find;
- Spec_Suffix_Length := S_Suffix'Length;
+ if S_Suffix /= No_File then
+ Spec_Suffix := Name_Id (S_Suffix);
+ Spec_Suffix_Length := Natural (Length_Of_Name (Spec_Suffix));
end if;
end Get_Suffixes;
@@ -175,14 +171,15 @@ package body Prj.Util is
begin
if Ada_Main then
- Get_Suffixes
- (B_Suffix => Body_Suffix_Of (In_Tree, "ada", Naming),
- S_Suffix => Spec_Suffix_Of (In_Tree, "ada", Naming));
-
+ Lang := Get_Language_From_Name (Project, "ada");
elsif Language /= "" then
+ Lang := Get_Language_From_Name (Project, Language);
+ end if;
+
+ if Lang /= null then
Get_Suffixes
- (B_Suffix => Body_Suffix_Of (In_Tree, Language, Naming),
- S_Suffix => Spec_Suffix_Of (In_Tree, Language, Naming));
+ (B_Suffix => Lang.Config.Naming_Data.Body_Suffix,
+ S_Suffix => Lang.Config.Naming_Data.Spec_Suffix);
end if;
if Builder_Package /= No_Package then
@@ -217,7 +214,8 @@ package body Prj.Util is
Truncated : Boolean := False;
begin
- if Last > Natural (Length_Of_Name (Body_Suffix))
+ if Body_Suffix /= No_Name
+ and then Last > Natural (Length_Of_Name (Body_Suffix))
and then Name (Last - Body_Suffix_Length + 1 .. Last) =
Get_Name_String (Body_Suffix)
then
@@ -225,7 +223,8 @@ package body Prj.Util is
Last := Last - Body_Suffix_Length;
end if;
- if not Truncated
+ if Spec_Suffix /= No_Name
+ and then not Truncated
and then Last > Spec_Suffix_Length
and then Name (Last - Spec_Suffix_Length + 1 .. Last) =
Get_Name_String (Spec_Suffix)