summaryrefslogtreecommitdiff
path: root/gcc/ada/makeutl.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-06 10:44:33 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-06 10:44:33 +0000
commit4c5d0f700faf7cc4bad7da213d5799e924253cdf (patch)
treed5faf65f688ce9d431c15195adea371db53dcf30 /gcc/ada/makeutl.adb
parentc091257074c65f39d9ba23ef191ad9bdf687cbfe (diff)
downloadgcc-4c5d0f700faf7cc4bad7da213d5799e924253cdf.tar.gz
2013-02-06 Robert Dewar <dewar@adacore.com>
* osint.ads: Minor fix of typo. 2013-02-06 Sergey Rybin <rybin@adacore.com frybin> * gnat_ugn.texi: gnatmetric: update the documentation of complexity metrics for Ada 2012. 2013-02-06 Javier Miranda <miranda@adacore.com> * exp_disp.adb (Make_Secondary_DT): Code cleanup: remove useless initialization. 2013-02-06 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Build_Discriminant_Constraints): Do not generate overflow checks on a discriminant expression if the discriminant constraint is applied to a private type that has a full view, because the check will be applied when the full view is elaborated. Removing the redundant check is not just an optimization, but it prevents spurious assembler errors, because of the way the backend generates names for expressions that require overflow checking. 2013-02-06 Pascal Obry <obry@adacore.com> * s-osprim-mingw.adb: Removes workaround for an old GNU/Linker limitation on Windows. (DA): Removed. (LIA): Removed. (LLIA): Removed. (TFA): Removed. (BTA): Removed. (BMTA): Removed. (BCA): Removed. (BMCA): Removed. (BTiA): Removed. (Clock): Use variable corresponding to access. (Get_Base_Time): Likewise. (Monotonic_Clock): Likewise. 2013-02-06 Vincent Celier <celier@adacore.com> * make.adb (Gnatmake): When gnatmake is called with a project file, do not invoke gnatbind with -I-. * makeutl.adb (Create_Binder_Mapping_File): Rewrite function. Get the infos from all the sources. 2013-02-06 Ed Schonberg <schonberg@adacore.com> * snames.ads-tmpl: Add Name_Overriding_Renamings and pragma Overriding_Renamings. * par-prag.adb: Recognize pragma Overriding_Renamings. * opt.ads (Overriding_Renamings): flag to control compatibility mode with Rational compiler, replaces Rational_Profile flag. * sem_ch8.adb (Analyze_Subprogram_Renaming): When Overriding_Renamings is enabled, accept renaming declarations where the new subprogram renames and overrides a locally inherited operation. Improve error message for some illegal renamings. * sem_prag.adb (Analyze_Pragma): Add case for Overriding_Renamings. (Set_Rational_Profile): The Rational_Profile enables Overriding_Renamings, Implicit_Packing, and Use_Vads_Size. 2013-02-06 Ed Schonberg <schonberg@adacore.com> * sem_util.adb: Set parent of copied aggregate component, to prevent infinite loop. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/makeutl.adb')
-rw-r--r--gcc/ada/makeutl.adb202
1 files changed, 107 insertions, 95 deletions
diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb
index b2a6d53bb48..6d33aaacca7 100644
--- a/gcc/ada/makeutl.adb
+++ b/gcc/ada/makeutl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2013, 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- --
@@ -369,6 +369,14 @@ package body Makeutl is
Status : Boolean;
-- For call to Close
+ Iter : Source_Iterator :=
+ For_Each_Source
+ (In_Tree => Project_Tree,
+ Language => Name_Ada,
+ Encapsulated_Libs => False,
+ Locally_Removed => False);
+ Source : Prj.Source_Id;
+
begin
Tempdir.Create_Temp_File (Mapping_FD, Mapping_Path);
Record_Temp_File (Project_Tree.Shared, Mapping_Path);
@@ -376,57 +384,62 @@ package body Makeutl is
if Mapping_FD /= Invalid_FD then
OK := True;
- -- Traverse all units
+ loop
+ Source := Element (Iter);
+ exit when Source = No_Source;
- Unit := Units_Htable.Get_First (Project_Tree.Units_HT);
- while Unit /= No_Unit_Index loop
- if Unit.Name /= No_Name then
+ Unit := Source.Unit;
- -- If there is a body, put it in the mapping
+ if Unit = No_Unit_Index or else Unit.Name = No_Name then
+ ALI_Name := No_File;
- if Unit.File_Names (Impl) /= No_Source
- and then Unit.File_Names (Impl).Project /= No_Project
- then
- Get_Name_String (Unit.Name);
- Add_Str_To_Name_Buffer ("%b");
- ALI_Unit := Name_Find;
- ALI_Name :=
- Lib_File_Name (Unit.File_Names (Impl).Display_File);
- ALI_Project := Unit.File_Names (Impl).Project;
+ -- If this is a body, put it in the mapping
- -- Otherwise, if there is a spec, put it in the mapping
-
- elsif Unit.File_Names (Spec) /= No_Source
- and then Unit.File_Names (Spec).Project /= No_Project
- then
- Get_Name_String (Unit.Name);
- Add_Str_To_Name_Buffer ("%s");
- ALI_Unit := Name_Find;
- ALI_Name :=
- Lib_File_Name (Unit.File_Names (Spec).Display_File);
- ALI_Project := Unit.File_Names (Spec).Project;
+ elsif Source.Kind = Impl
+ and then Unit.File_Names (Impl) /= No_Source
+ and then Unit.File_Names (Impl).Project /= No_Project
+ then
+ Get_Name_String (Unit.Name);
+ Add_Str_To_Name_Buffer ("%b");
+ ALI_Unit := Name_Find;
+ ALI_Name :=
+ Lib_File_Name (Unit.File_Names (Impl).Display_File);
+ ALI_Project := Unit.File_Names (Impl).Project;
+
+ -- Otherwise, if this is a spec and there is no body, put it in
+ -- the mapping.
+
+ elsif Source.Kind = Spec
+ and then Unit.File_Names (Impl) = No_Source
+ and then Unit.File_Names (Spec) /= No_Source
+ and then Unit.File_Names (Spec).Project /= No_Project
+ then
+ Get_Name_String (Unit.Name);
+ Add_Str_To_Name_Buffer ("%s");
+ ALI_Unit := Name_Find;
+ ALI_Name :=
+ Lib_File_Name (Unit.File_Names (Spec).Display_File);
+ ALI_Project := Unit.File_Names (Spec).Project;
- else
- ALI_Name := No_File;
- end if;
+ else
+ ALI_Name := No_File;
+ end if;
- -- If we have something to put in the mapping then do it now.
- -- However, if the project is extended, we don't put anything
- -- in the mapping file, since we don't know where the ALI file
- -- is: it might be in the extended project object directory as
- -- well as in the extending project object directory.
+ -- If we have something to put in the mapping then do it now. If
+ -- the project is extended, look for the ALI file in the project,
+ -- then in the extending projects in order, and use the last one
+ -- found.
- if ALI_Name /= No_File
- and then ALI_Project.Extended_By = No_Project
- and then ALI_Project.Extends = No_Project
- then
- -- First check if the ALI file exists. If it does not, do
- -- not put the unit in the mapping file.
+ if ALI_Name /= No_File then
+ -- Look in the project and the projects that are extending it
+ -- to find the real ALI file.
- declare
- ALI : constant String := Get_Name_String (ALI_Name);
+ declare
+ ALI : constant String := Get_Name_String (ALI_Name);
- begin
+ ALI_Path : Name_Id := No_Name;
+ begin
+ loop
-- For library projects, use the library ALI directory,
-- for other projects, use the object directory.
@@ -439,63 +452,62 @@ package body Makeutl is
end if;
Add_Str_To_Name_Buffer (ALI);
+
+ if Is_Regular_File (Name_Buffer (1 .. Name_Len)) then
+ ALI_Path := Name_Find;
+ end if;
+
+ ALI_Project := ALI_Project.Extended_By;
+ exit when ALI_Project = No_Project;
+ end loop;
+
+ if ALI_Path /= No_Name then
+ -- First line is the unit name
+
+ Get_Name_String (ALI_Unit);
Add_Char_To_Name_Buffer (ASCII.LF);
+ Bytes :=
+ Write
+ (Mapping_FD,
+ Name_Buffer (1)'Address,
+ Name_Len);
+ OK := Bytes = Name_Len;
- declare
- ALI_Path_Name : constant String :=
- Name_Buffer (1 .. Name_Len);
+ exit when not OK;
- begin
- if Is_Regular_File
- (ALI_Path_Name (1 .. ALI_Path_Name'Last - 1))
- then
- -- First line is the unit name
-
- Get_Name_String (ALI_Unit);
- Add_Char_To_Name_Buffer (ASCII.LF);
- Bytes :=
- Write
- (Mapping_FD,
- Name_Buffer (1)'Address,
- Name_Len);
- OK := Bytes = Name_Len;
-
- exit when not OK;
-
- -- Second line it the ALI file name
-
- Get_Name_String (ALI_Name);
- Add_Char_To_Name_Buffer (ASCII.LF);
- Bytes :=
- Write
- (Mapping_FD,
- Name_Buffer (1)'Address,
- Name_Len);
- OK := (Bytes = Name_Len);
-
- exit when not OK;
-
- -- Third line it the ALI path name
-
- Bytes :=
- Write
- (Mapping_FD,
- ALI_Path_Name (1)'Address,
- ALI_Path_Name'Length);
- OK := (Bytes = ALI_Path_Name'Length);
-
- -- If OK is False, it means we were unable to
- -- write a line. No point in continuing with the
- -- other units.
-
- exit when not OK;
- end if;
- end;
- end;
- end if;
+ -- Second line it the ALI file name
+
+ Get_Name_String (ALI_Name);
+ Add_Char_To_Name_Buffer (ASCII.LF);
+ Bytes :=
+ Write
+ (Mapping_FD,
+ Name_Buffer (1)'Address,
+ Name_Len);
+ OK := (Bytes = Name_Len);
+
+ exit when not OK;
+
+ -- Third line it the ALI path name
+
+ Get_Name_String (ALI_Path);
+ Add_Char_To_Name_Buffer (ASCII.LF);
+ Bytes :=
+ Write
+ (Mapping_FD,
+ Name_Buffer (1)'Address,
+ Name_Len);
+ OK := (Bytes = Name_Len);
+
+ -- If OK is False, it means we were unable to write a
+ -- line. No point in continuing with the other units.
+
+ exit when not OK;
+ end if;
+ end;
end if;
- Unit := Units_Htable.Get_Next (Project_Tree.Units_HT);
+ Next (Iter);
end loop;
Close (Mapping_FD, Status);