Commit 86828d40 by Arnaud Charlet

[multiple changes]

2011-09-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch5.adb (Analyze_Iterator_Specification): If the domain
	of iteration is an expression, its value must be captured in a
	renaming declaration, so that modification of the elements is
	propagated to the original container.

2011-09-02  Pascal Obry  <obry@adacore.com>

	* prj-proc.adb, prj.adb, makeutl.adb, makeutl.ads, prj-dect.adb,
	prj-nmsc.adb, prj-util.adb, prj-conf.adb, prj-env.adb,
	prj-tree.adb: Minor reformatting and style fixes.

From-SVN: r178443
parent da6feece
2011-09-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb (Analyze_Iterator_Specification): If the domain
of iteration is an expression, its value must be captured in a
renaming declaration, so that modification of the elements is
propagated to the original container.
2011-09-02 Pascal Obry <obry@adacore.com>
* prj-proc.adb, prj.adb, makeutl.adb, makeutl.ads, prj-dect.adb,
prj-nmsc.adb, prj-util.adb, prj-conf.adb, prj-env.adb,
prj-tree.adb: Minor reformatting and style fixes.
2011-09-02 Robert Dewar <dewar@adacore.com>
* s-rident.ads: Add new restriction No_Implicit_Aliasing
......
......@@ -336,7 +336,7 @@ package Makeutl is
Need_Compilation : Boolean := True;
Need_Binding : Boolean := True;
Need_Linking : Boolean := True;
-- Which of the compilation phases are needed for this project tree.
-- Which of the compilation phases are needed for this project tree
end record;
type Builder_Data_Access is access all Builder_Project_Tree_Data;
......@@ -459,10 +459,10 @@ package Makeutl is
Id : Source_Id := null;
when Format_Gnatmake =>
File : File_Name_Type := No_File;
Unit : Unit_Name_Type := No_Unit_Name;
Index : Int := 0;
Project : Project_Id := No_Project;
File : File_Name_Type := No_File;
Unit : Unit_Name_Type := No_Unit_Name;
Index : Int := 0;
Project : Project_Id := No_Project;
end case;
end record;
-- Information about files stored in the queue. The exact information
......@@ -473,7 +473,7 @@ package Makeutl is
procedure Initialize
(Queue_Per_Obj_Dir : Boolean;
Force : Boolean := False);
Force : Boolean := False);
-- Initialize the queue.
-- Queue_Per_Obj_Dir matches the --single-compile-per-obj-dir switch:
-- when True, there cannot be simultaneous compilations with the object
......
......@@ -508,9 +508,9 @@ package body Prj.Conf is
else
Add_Attributes
(Project_Tree => Project_Tree,
Conf_Decl => Conf_Pack.Decl,
User_Decl =>
(Project_Tree => Project_Tree,
Conf_Decl => Conf_Pack.Decl,
User_Decl =>
Shared.Packages.Table (User_Pack_Id).Decl);
end if;
......@@ -532,8 +532,7 @@ package body Prj.Conf is
("Recursively apply config to aggregated tree",
List.Project.Name);
Apply_Config_File
(Config_File,
Project_Tree => List.Tree);
(Config_File, Project_Tree => List.Tree);
List := List.Next;
end loop;
end;
......@@ -1132,8 +1131,7 @@ package body Prj.Conf is
if Config_File_Name = "" then
if Obj_Dir_Exists then
Args (3) :=
new String'(Obj_Dir & Directory_Separator & Auto_Cgpr);
Args (3) := new String'(Obj_Dir & Auto_Cgpr);
else
declare
......@@ -1154,9 +1152,7 @@ package body Prj.Conf is
else
-- We'll have an error message later on
Args (3) :=
new String'
(Obj_Dir & Directory_Separator & Auto_Cgpr);
Args (3) := new String'(Obj_Dir & Auto_Cgpr);
end if;
end;
end if;
......
......@@ -23,11 +23,11 @@
-- --
------------------------------------------------------------------------------
with Err_Vars; use Err_Vars;
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Spelling_Checker; use GNAT.Spelling_Checker;
with GNAT.Strings;
with Err_Vars; use Err_Vars;
with Opt; use Opt;
with Prj.Attr; use Prj.Attr;
with Prj.Attr.PM; use Prj.Attr.PM;
......@@ -37,8 +37,6 @@ with Prj.Tree; use Prj.Tree;
with Snames;
with Uintp; use Uintp;
with GNAT.Strings;
package body Prj.Dect is
use GNAT;
......@@ -58,10 +56,10 @@ package body Prj.Dect is
-- new name, so that the code does not have to check both names forever.
procedure Check_Attribute_Allowed
(In_Tree : Project_Node_Tree_Ref;
Project : Project_Node_Id;
Attribute : Project_Node_Id;
Flags : Processing_Flags);
(In_Tree : Project_Node_Tree_Ref;
Project : Project_Node_Id;
Attribute : Project_Node_Id;
Flags : Processing_Flags);
-- Check whether the attribute is valid in this project.
-- In particular, depending on the type of project (qualifier), some
-- attributes might be disabled.
......@@ -186,20 +184,20 @@ package body Prj.Dect is
and then Expression_Kind_Of (Current_Package, In_Tree) /= Ignored
then
case Name_Of (Attribute, In_Tree) is
when Snames.Name_Specification =>
Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Spec);
when Snames.Name_Specification =>
Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Spec);
when Snames.Name_Specification_Suffix =>
Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Spec_Suffix);
when Snames.Name_Specification_Suffix =>
Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Spec_Suffix);
when Snames.Name_Implementation =>
Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Body);
when Snames.Name_Implementation =>
Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Body);
when Snames.Name_Implementation_Suffix =>
Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Body_Suffix);
when Snames.Name_Implementation_Suffix =>
Set_Name_Of (Attribute, In_Tree, To => Snames.Name_Body_Suffix);
when others =>
null;
when others =>
null;
end case;
end if;
end Rename_Obsolescent_Attributes;
......@@ -234,10 +232,10 @@ package body Prj.Dect is
-----------------------------
procedure Check_Attribute_Allowed
(In_Tree : Project_Node_Tree_Ref;
Project : Project_Node_Id;
Attribute : Project_Node_Id;
Flags : Processing_Flags)
(In_Tree : Project_Node_Tree_Ref;
Project : Project_Node_Id;
Attribute : Project_Node_Id;
Flags : Processing_Flags)
is
Qualif : constant Project_Qualifier :=
Project_Qualifier_Of (Project, In_Tree);
......
......@@ -272,15 +272,15 @@ package body Prj.Env is
begin
-- Check if the directory is already in the table
for Index in Object_Path_Table.First ..
Object_Path_Table.Last (Object_Paths)
for Index in
Object_Path_Table.First .. Object_Path_Table.Last (Object_Paths)
loop
-- If it is, remove it, and add it as the last one
if Object_Paths.Table (Index) = Object_Dir then
for Index2 in Index + 1 ..
Object_Path_Table.Last (Object_Paths)
for Index2 in
Index + 1 .. Object_Path_Table.Last (Object_Paths)
loop
Object_Paths.Table (Index2 - 1) := Object_Paths.Table (Index2);
end loop;
......@@ -422,8 +422,8 @@ package body Prj.Env is
-- Check if the source directory is already in the table
for Index in Source_Path_Table.First ..
Source_Path_Table.Last (Source_Paths)
for Index in
Source_Path_Table.First .. Source_Path_Table.Last (Source_Paths)
loop
-- If it is already, no need to add it
......@@ -458,6 +458,7 @@ package body Prj.Env is
Table_Low_Bound => 1,
Table_Initial => 5,
Table_Increment => 100);
Default_Naming : constant Naming_Id := Naming_Table.First;
Namings : Naming_Table.Instance;
-- Table storing the naming data for gnatmake/gprmake
......@@ -779,7 +780,7 @@ package body Prj.Env is
is
File : File_Descriptor := Invalid_FD;
Buffer : String_Access := new String (1 .. Buffer_Initial);
Buffer : String_Access := new String (1 .. Buffer_Initial);
Buffer_Last : Natural := 0;
procedure Put_Name_Buffer;
......@@ -831,9 +832,8 @@ package body Prj.Env is
if Source.Replaced_By = No_Source
and then Source.Path.Name /= No_Path
and then
(Source.Language.Config.Kind = File_Based
or else Source.Unit /= No_Unit_Index)
and then (Source.Language.Config.Kind = File_Based
or else Source.Unit /= No_Unit_Index)
then
if Source.Unit /= No_Unit_Index then
......@@ -999,12 +999,12 @@ package body Prj.Env is
Main_Project_Only : Boolean := True;
Full_Path : Boolean := False) return String
is
Lang : constant Language_Ptr :=
Get_Language_From_Name (Project, "ada");
The_Project : Project_Id := Project;
Original_Name : String := Name;
Lang : constant Language_Ptr :=
Get_Language_From_Name (Project, "ada");
Unit : Unit_Index;
The_Original_Name : Name_Id;
The_Spec_Name : Name_Id;
......@@ -1140,10 +1140,8 @@ package body Prj.Env is
-- Check for spec
if not Main_Project_Only
or else
(Unit.File_Names (Spec) /= null
and then Unit.File_Names (Spec).Project =
The_Project)
or else (Unit.File_Names (Spec) /= null
and then Unit.File_Names (Spec).Project = The_Project)
then
declare
Current_Name : File_Name_Type;
......@@ -1670,7 +1668,7 @@ package body Prj.Env is
-- For the object path, we make a distinction depending on
-- Including_Libraries.
if Objects_Path and Including_Libraries then
if Objects_Path and then Including_Libraries then
if Project.Objects_Path_File_With_Libs = No_Path then
Object_Path_Table.Init (Object_Paths);
Process_Object_Dirs := True;
......@@ -1690,7 +1688,7 @@ package body Prj.Env is
-- If there is something to do, set Seen to False for all projects,
-- then call the recursive procedure Add for Project.
if Process_Source_Dirs or Process_Object_Dirs then
if Process_Source_Dirs or else Process_Object_Dirs then
For_All_Projects (Project, In_Tree, Dummy);
end if;
......@@ -1701,8 +1699,8 @@ package body Prj.Env is
if Source_FD /= Invalid_FD then
Buffer_Last := 0;
for Index in Source_Path_Table.First ..
Source_Path_Table.Last (Source_Paths)
for Index in
Source_Path_Table.First .. Source_Path_Table.Last (Source_Paths)
loop
Get_Name_String (Source_Paths.Table (Index));
Name_Len := Name_Len + 1;
......@@ -1727,8 +1725,8 @@ package body Prj.Env is
if Object_FD /= Invalid_FD then
Buffer_Last := 0;
for Index in Object_Path_Table.First ..
Object_Path_Table.Last (Object_Paths)
for Index in
Object_Path_Table.First .. Object_Path_Table.Last (Object_Paths)
loop
Get_Name_String (Object_Paths.Table (Index));
Name_Len := Name_Len + 1;
......@@ -1752,9 +1750,10 @@ package body Prj.Env is
-- Set the env vars, if they need to be changed, and set the
-- corresponding flags.
if Include_Path and then
Shared.Private_Part.Current_Source_Path_File /=
Project.Include_Path_File
if Include_Path
and then
Shared.Private_Part.Current_Source_Path_File /=
Project.Include_Path_File
then
Shared.Private_Part.Current_Source_Path_File :=
Project.Include_Path_File;
......@@ -2268,7 +2267,6 @@ package body Prj.Env is
end if;
-- No need to copy the Cache, it will be recomputed as needed
end Copy;
end Prj.Env;
......@@ -104,7 +104,6 @@ package body Prj.Tree is
Zone := In_Tree.Project_Nodes.Table (To).Comments;
if No (Zone) then
-- Create new N_Comment_Zones node
Project_Node_Table.Increment_Last (In_Tree.Project_Nodes);
......@@ -144,9 +143,9 @@ package body Prj.Tree is
-- Create new N_Comment node
if (Where = After or else Where = After_End) and then
Token /= Tok_EOF and then
Comments.Table (J).Follows_Empty_Line
if (Where = After or else Where = After_End)
and then Token /= Tok_EOF
and then Comments.Table (J).Follows_Empty_Line
then
Comments.Table (1 .. Comments.Last - J + 1) :=
Comments.Table (J .. Comments.Last);
......
......@@ -128,8 +128,8 @@ package body Prj.Util is
---------------
procedure Duplicate
(This : in out Name_List_Index;
Shared : Shared_Project_Tree_Data_Access)
(This : in out Name_List_Index;
Shared : Shared_Project_Tree_Data_Access)
is
Old_Current : Name_List_Index;
New_Current : Name_List_Index;
......
......@@ -358,7 +358,6 @@ package body Prj is
Name_Len := Name_Len - 1;
return Name_Find;
end Extend_Name;
---------------------
......@@ -377,7 +376,7 @@ package body Prj is
procedure Language_Changed (Iter : in out Source_Iterator) is
begin
Iter.Current := No_Source;
Iter.Current := No_Source;
if Iter.Language_Name /= No_Name then
while Iter.Language /= null
......@@ -580,6 +579,7 @@ package body Prj is
begin
Iterator := For_Each_Source (In_Tree => Tree, Project => Proj);
while Element (Iterator) /= No_Source loop
if Element (Iterator).File = Base_Name
and then (Index = 0 or else Element (Iterator).Index = Index)
......@@ -626,6 +626,7 @@ package body Prj is
Include_Aggregated => False,
With_State => Result);
end if;
else
Look_For_Sources (No_Project, In_Tree, Result);
end if;
......@@ -1363,8 +1364,8 @@ package body Prj is
procedure For_All_Projects is
new For_Every_Project_Imported (Boolean, Recursive_Add);
Dummy : Boolean := False;
List : Project_List;
Dummy : Boolean := False;
List : Project_List;
begin
List := Local_Tree.Projects;
......
......@@ -2263,6 +2263,8 @@ package body Sem_Ch5 is
-- If domain of iteration is an expression, create a declaration for it,
-- so that finalization actions are introduced outside of the loop.
-- The declaration must be a renaming because the body of the loop may
-- assign to elements.
if not Is_Entity_Name (Iter_Name) then
declare
......@@ -2273,10 +2275,10 @@ package body Sem_Ch5 is
Typ := Etype (Iter_Name);
Decl :=
Make_Object_Declaration (Loc,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Id,
Object_Definition => New_Occurrence_Of (Typ, Loc),
Expression => Relocate_Node (Iter_Name));
Subtype_Mark => New_Occurrence_Of (Typ, Loc),
Name => Relocate_Node (Iter_Name));
Insert_Actions (Parent (Parent (N)), New_List (Decl));
Rewrite (Name (N), New_Occurrence_Of (Id, Loc));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment