Commit 570d3cfb by Vincent Celier Committed by Arnaud Charlet

2008-08-04 Vincent Celier <celier@adacore.com>

	* prj-proc.adb:
	(Copy_Package_Declarations): When inheriting package Naming from a
	project being extended, do not inherit source exception names.

From-SVN: r138578
parent 67198556
...@@ -83,12 +83,15 @@ package body Prj.Proc is ...@@ -83,12 +83,15 @@ package body Prj.Proc is
-- Current_Dir is for optimization purposes, avoiding extra system calls. -- Current_Dir is for optimization purposes, avoiding extra system calls.
procedure Copy_Package_Declarations procedure Copy_Package_Declarations
(From : Declarations; (From : Declarations;
To : in out Declarations; To : in out Declarations;
New_Loc : Source_Ptr; New_Loc : Source_Ptr;
In_Tree : Project_Tree_Ref); Naming_Restricted : Boolean;
In_Tree : Project_Tree_Ref);
-- Copy a package declaration From to To for a renamed package. Change the -- Copy a package declaration From to To for a renamed package. Change the
-- locations of all the attributes to New_Loc. -- locations of all the attributes to New_Loc. When Naming_Restricted is
-- True, do not copy attributes Body, Spec, Implementation and
-- Specification.
function Expression function Expression
(Project : Project_Id; (Project : Project_Id;
...@@ -310,10 +313,11 @@ package body Prj.Proc is ...@@ -310,10 +313,11 @@ package body Prj.Proc is
------------------------------- -------------------------------
procedure Copy_Package_Declarations procedure Copy_Package_Declarations
(From : Declarations; (From : Declarations;
To : in out Declarations; To : in out Declarations;
New_Loc : Source_Ptr; New_Loc : Source_Ptr;
In_Tree : Project_Tree_Ref) Naming_Restricted : Boolean;
In_Tree : Project_Tree_Ref)
is is
V1 : Variable_Id := From.Attributes; V1 : Variable_Id := From.Attributes;
V2 : Variable_Id := No_Variable; V2 : Variable_Id := No_Variable;
...@@ -368,67 +372,73 @@ package body Prj.Proc is ...@@ -368,67 +372,73 @@ package body Prj.Proc is
while A1 /= No_Array loop while A1 /= No_Array loop
-- Copy the array
Arr := In_Tree.Arrays.Table (A1); Arr := In_Tree.Arrays.Table (A1);
A1 := Arr.Next; A1 := Arr.Next;
-- Remove the Next component if not Naming_Restricted or else
(Arr.Name /= Snames.Name_Body
and then Arr.Name /= Snames.Name_Spec
and then Arr.Name /= Snames.Name_Implementation
and then Arr.Name /= Snames.Name_Specification)
then
-- Remove the Next component
Arr.Next := No_Array; Arr.Next := No_Array;
Array_Table.Increment_Last (In_Tree.Arrays); Array_Table.Increment_Last (In_Tree.Arrays);
-- Create new Array declaration -- Create new Array declaration
if To.Arrays = No_Array then
To.Arrays := Array_Table.Last (In_Tree.Arrays);
else if To.Arrays = No_Array then
In_Tree.Arrays.Table (A2).Next := To.Arrays := Array_Table.Last (In_Tree.Arrays);
Array_Table.Last (In_Tree.Arrays);
end if;
A2 := Array_Table.Last (In_Tree.Arrays); else
In_Tree.Arrays.Table (A2).Next :=
Array_Table.Last (In_Tree.Arrays);
end if;
-- Don't store the array, as its first element has not been set yet A2 := Array_Table.Last (In_Tree.Arrays);
-- Copy the array elements of the array -- Don't store the array as its first element has not been set yet
E1 := Arr.Value; -- Copy the array elements of the array
Arr.Value := No_Array_Element;
while E1 /= No_Array_Element loop E1 := Arr.Value;
Arr.Value := No_Array_Element;
while E1 /= No_Array_Element loop
-- Copy the array element -- Copy the array element
Elm := In_Tree.Array_Elements.Table (E1); Elm := In_Tree.Array_Elements.Table (E1);
E1 := Elm.Next; E1 := Elm.Next;
-- Remove the Next component -- Remove the Next component
Elm.Next := No_Array_Element; Elm.Next := No_Array_Element;
-- Change the location -- Change the location
Elm.Value.Location := New_Loc; Elm.Value.Location := New_Loc;
Array_Element_Table.Increment_Last (In_Tree.Array_Elements); Array_Element_Table.Increment_Last (In_Tree.Array_Elements);
-- Create new array element -- Create new array element
if Arr.Value = No_Array_Element then if Arr.Value = No_Array_Element then
Arr.Value := Array_Element_Table.Last (In_Tree.Array_Elements); Arr.Value :=
else Array_Element_Table.Last (In_Tree.Array_Elements);
In_Tree.Array_Elements.Table (E2).Next := else
Array_Element_Table.Last (In_Tree.Array_Elements); In_Tree.Array_Elements.Table (E2).Next :=
end if; Array_Element_Table.Last (In_Tree.Array_Elements);
end if;
E2 := Array_Element_Table.Last (In_Tree.Array_Elements); E2 := Array_Element_Table.Last (In_Tree.Array_Elements);
In_Tree.Array_Elements.Table (E2) := Elm; In_Tree.Array_Elements.Table (E2) := Elm;
end loop; end loop;
-- Finally, store the new array -- Finally, store the new array
In_Tree.Arrays.Table (A2) := Arr; In_Tree.Arrays.Table (A2) := Arr;
end if;
end loop; end loop;
end Copy_Package_Declarations; end Copy_Package_Declarations;
...@@ -1343,14 +1353,15 @@ package body Prj.Proc is ...@@ -1343,14 +1353,15 @@ package body Prj.Proc is
-- renaming declaration. -- renaming declaration.
Copy_Package_Declarations Copy_Package_Declarations
(From => (From =>
In_Tree.Packages.Table (Renamed_Package).Decl, In_Tree.Packages.Table (Renamed_Package).Decl,
To => To =>
In_Tree.Packages.Table (New_Pkg).Decl, In_Tree.Packages.Table (New_Pkg).Decl,
New_Loc => New_Loc =>
Location_Of Location_Of
(Current_Item, From_Project_Node_Tree), (Current_Item, From_Project_Node_Tree),
In_Tree => In_Tree); Naming_Restricted => False,
In_Tree => In_Tree);
end; end;
-- Standard package declaration, not renaming -- Standard package declaration, not renaming
...@@ -2730,10 +2741,13 @@ package body Prj.Proc is ...@@ -2730,10 +2741,13 @@ package body Prj.Proc is
Next => Processed_Data.Decl.Packages); Next => Processed_Data.Decl.Packages);
Processed_Data.Decl.Packages := Current_Pkg; Processed_Data.Decl.Packages := Current_Pkg;
Copy_Package_Declarations Copy_Package_Declarations
(From => Element.Decl, (From => Element.Decl,
To => In_Tree.Packages.Table (Current_Pkg).Decl, To =>
New_Loc => No_Location, In_Tree.Packages.Table (Current_Pkg).Decl,
In_Tree => In_Tree); New_Loc => No_Location,
Naming_Restricted =>
Element.Name = Snames.Name_Naming,
In_Tree => In_Tree);
end if; end if;
Extended_Pkg := Element.Next; Extended_Pkg := Element.Next;
......
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