Commit 35fae080 by Robert Dewar Committed by Arnaud Charlet

a-coinve.adb, [...]: Minor reformatting.

2011-12-02  Robert Dewar  <dewar@adacore.com>

	* a-coinve.adb, a-coorma.adb, freeze.adb, a-coorse.adb, a-comutr.adb,
	a-coormu.adb, a-convec.adb: Minor reformatting.

From-SVN: r181913
parent e47e21c1
2011-12-02 Robert Dewar <dewar@adacore.com>
* a-coinve.adb, a-coorma.adb, freeze.adb, a-coorse.adb, a-comutr.adb,
a-coormu.adb, a-convec.adb: Minor reformatting.
2011-12-02 Matthew Heaney <heaney@adacore.com> 2011-12-02 Matthew Heaney <heaney@adacore.com>
* a-coormu.ads, a-ciormu.ads: Declare iterator factory function. * a-coormu.ads, a-ciormu.ads: Declare iterator factory function.
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
with Ada.Containers.Generic_Array_Sort; with Ada.Containers.Generic_Array_Sort;
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
with System; use type System.Address; with System; use type System.Address;
package body Ada.Containers.Indefinite_Vectors is package body Ada.Containers.Indefinite_Vectors is
...@@ -1112,7 +1113,6 @@ package body Ada.Containers.Indefinite_Vectors is ...@@ -1112,7 +1113,6 @@ package body Ada.Containers.Indefinite_Vectors is
if Object.Container /= null then if Object.Container /= null then
declare declare
B : Natural renames Object.Container.all.Busy; B : Natural renames Object.Container.all.Busy;
begin begin
B := B - 1; B := B - 1;
end; end;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
with Ada.Unchecked_Conversion; with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
with System; use type System.Address; with System; use type System.Address;
package body Ada.Containers.Multiway_Trees is package body Ada.Containers.Multiway_Trees is
...@@ -913,7 +914,6 @@ package body Ada.Containers.Multiway_Trees is ...@@ -913,7 +914,6 @@ package body Ada.Containers.Multiway_Trees is
if Object.Container /= null then if Object.Container /= null then
declare declare
B : Natural renames Object.Container.all.Busy; B : Natural renames Object.Container.all.Busy;
begin begin
B := B - 1; B := B - 1;
end; end;
...@@ -925,7 +925,6 @@ package body Ada.Containers.Multiway_Trees is ...@@ -925,7 +925,6 @@ package body Ada.Containers.Multiway_Trees is
if Object.Container /= null then if Object.Container /= null then
declare declare
B : Natural renames Object.Container.all.Busy; B : Natural renames Object.Container.all.Busy;
begin begin
B := B - 1; B := B - 1;
end; end;
...@@ -942,13 +941,12 @@ package body Ada.Containers.Multiway_Trees is ...@@ -942,13 +941,12 @@ package body Ada.Containers.Multiway_Trees is
is is
N : constant Tree_Node_Access := N : constant Tree_Node_Access :=
Find_In_Children (Root_Node (Container), Item); Find_In_Children (Root_Node (Container), Item);
begin begin
if N = null then if N = null then
return No_Element; return No_Element;
else
return Cursor'(Container'Unrestricted_Access, N);
end if; end if;
return Cursor'(Container'Unrestricted_Access, N);
end Find; end Find;
----------- -----------
...@@ -1071,11 +1069,8 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1071,11 +1069,8 @@ package body Ada.Containers.Multiway_Trees is
function Has_Element (Position : Cursor) return Boolean is function Has_Element (Position : Cursor) return Boolean is
begin begin
if Position = No_Element then return (if Position = No_Element then False
return False; else Position.Node.Parent /= null);
end if;
return Position.Node.Parent /= null;
end Has_Element; end Has_Element;
------------------ ------------------
...@@ -1325,11 +1320,8 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1325,11 +1320,8 @@ package body Ada.Containers.Multiway_Trees is
function Is_Leaf (Position : Cursor) return Boolean is function Is_Leaf (Position : Cursor) return Boolean is
begin begin
if Position = No_Element then return (if Position = No_Element then False
return False; else Position.Node.Children.First = null);
end if;
return Position.Node.Children.First = null;
end Is_Leaf; end Is_Leaf;
------------------ ------------------
...@@ -1361,11 +1353,8 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1361,11 +1353,8 @@ package body Ada.Containers.Multiway_Trees is
function Is_Root (Position : Cursor) return Boolean is function Is_Root (Position : Cursor) return Boolean is
begin begin
if Position.Container = null then return (if Position.Container = null then False
return False; else Position = Root (Position.Container.all));
end if;
return Position = Root (Position.Container.all);
end Is_Root; end Is_Root;
------------- -------------
...@@ -1400,7 +1389,6 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1400,7 +1389,6 @@ package body Ada.Containers.Multiway_Trees is
B : Natural renames Container'Unrestricted_Access.all.Busy; B : Natural renames Container'Unrestricted_Access.all.Busy;
RC : constant Cursor := RC : constant Cursor :=
(Container'Unrestricted_Access, Root_Node (Container)); (Container'Unrestricted_Access, Root_Node (Container));
begin begin
return It : constant Iterator := return It : constant Iterator :=
Iterator'(Limited_Controlled with Iterator'(Limited_Controlled with
...@@ -1474,7 +1462,6 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1474,7 +1462,6 @@ package body Ada.Containers.Multiway_Trees is
return Tree_Iterator_Interfaces.Reversible_Iterator'Class return Tree_Iterator_Interfaces.Reversible_Iterator'Class
is is
B : Natural renames Container'Unrestricted_Access.all.Busy; B : Natural renames Container'Unrestricted_Access.all.Busy;
begin begin
return It : constant Child_Iterator := return It : constant Child_Iterator :=
Child_Iterator'(Limited_Controlled with Child_Iterator'(Limited_Controlled with
...@@ -1494,7 +1481,6 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1494,7 +1481,6 @@ package body Ada.Containers.Multiway_Trees is
return Tree_Iterator_Interfaces.Forward_Iterator'Class return Tree_Iterator_Interfaces.Forward_Iterator'Class
is is
B : Natural renames Position.Container'Unrestricted_Access.all.Busy; B : Natural renames Position.Container'Unrestricted_Access.all.Busy;
begin begin
return It : constant Iterator := return It : constant Iterator :=
Iterator'(Limited_Controlled with Iterator'(Limited_Controlled with
...@@ -1635,7 +1621,7 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1635,7 +1621,7 @@ package body Ada.Containers.Multiway_Trees is
begin begin
if Is_Leaf (Position) then if Is_Leaf (Position) then
-- If sibling is present, return it. -- If sibling is present, return it
if N.Next /= null then if N.Next /= null then
return (Object.Container, N.Next); return (Object.Container, N.Next);
...@@ -1650,7 +1636,7 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1650,7 +1636,7 @@ package body Ada.Containers.Multiway_Trees is
begin begin
while Par.Next = null loop while Par.Next = null loop
-- If we are back at the root the iteration is complete. -- If we are back at the root the iteration is complete
if Par = Root_Node (T) then if Par = Root_Node (T) then
return No_Element; return No_Element;
...@@ -1679,7 +1665,7 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1679,7 +1665,7 @@ package body Ada.Containers.Multiway_Trees is
end if; end if;
else else
-- If an internal node, return its first child. -- If an internal node, return its first child
return (Object.Container, N.Children.First); return (Object.Container, N.Children.First);
end if; end if;
...@@ -1790,7 +1776,7 @@ package body Ada.Containers.Multiway_Trees is ...@@ -1790,7 +1776,7 @@ package body Ada.Containers.Multiway_Trees is
for J in Count_Type'(2) .. Count loop for J in Count_Type'(2) .. Count loop
-- Reclaim other nodes if Storage_Error. ??? -- Reclaim other nodes if Storage_Error???
Last.Next := new Tree_Node_Type'(Parent => Parent.Node, Last.Next := new Tree_Node_Type'(Parent => Parent.Node,
Prev => Last, Prev => Last,
...@@ -2044,8 +2030,8 @@ package body Ada.Containers.Multiway_Trees is ...@@ -2044,8 +2030,8 @@ package body Ada.Containers.Multiway_Trees is
C : Children_Type renames Subtree.Parent.Children; C : Children_Type renames Subtree.Parent.Children;
begin begin
-- This is a utility operation to remove a subtree -- This is a utility operation to remove a subtree node from its
-- node from its parent's list of children. -- parent's list of children.
if C.First = Subtree then if C.First = Subtree then
pragma Assert (Subtree.Prev = null); pragma Assert (Subtree.Prev = null);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
with Ada.Containers.Generic_Array_Sort; with Ada.Containers.Generic_Array_Sort;
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
with System; use type System.Address; with System; use type System.Address;
package body Ada.Containers.Vectors is package body Ada.Containers.Vectors is
...@@ -785,7 +786,6 @@ package body Ada.Containers.Vectors is ...@@ -785,7 +786,6 @@ package body Ada.Containers.Vectors is
if Object.Container /= null then if Object.Container /= null then
declare declare
B : Natural renames Object.Container.all.Busy; B : Natural renames Object.Container.all.Busy;
begin begin
B := B - 1; B := B - 1;
end; end;
...@@ -923,7 +923,6 @@ package body Ada.Containers.Vectors is ...@@ -923,7 +923,6 @@ package body Ada.Containers.Vectors is
J : Index_Type'Base; J : Index_Type'Base;
begin begin
-- The semantics of Merge changed slightly per AI05-0021. It was -- The semantics of Merge changed slightly per AI05-0021. It was
-- originally the case that if Target and Source denoted the same -- originally the case that if Target and Source denoted the same
-- container object, then the GNAT implementation of Merge did -- container object, then the GNAT implementation of Merge did
...@@ -1489,8 +1488,8 @@ package body Ada.Containers.Vectors is ...@@ -1489,8 +1488,8 @@ package body Ada.Containers.Vectors is
K : Index_Type'Base; K : Index_Type'Base;
begin begin
-- We next copy the source items that follow the space we -- We next copy the source items that follow the space we inserted.
-- inserted. Index value K is the first index of that portion of the -- Index value K is the first index of that portion of the
-- destination that receives this slice of the source. (For the -- destination that receives this slice of the source. (For the
-- reasons given above, this slice is guaranteed to be non-empty.) -- reasons given above, this slice is guaranteed to be non-empty.)
......
...@@ -499,7 +499,6 @@ package body Ada.Containers.Ordered_Maps is ...@@ -499,7 +499,6 @@ package body Ada.Containers.Ordered_Maps is
if Object.Container /= null then if Object.Container /= null then
declare declare
B : Natural renames Object.Container.all.Tree.Busy; B : Natural renames Object.Container.all.Tree.Busy;
begin begin
B := B - 1; B := B - 1;
end; end;
...@@ -512,13 +511,9 @@ package body Ada.Containers.Ordered_Maps is ...@@ -512,13 +511,9 @@ package body Ada.Containers.Ordered_Maps is
function Find (Container : Map; Key : Key_Type) return Cursor is function Find (Container : Map; Key : Key_Type) return Cursor is
Node : constant Node_Access := Key_Ops.Find (Container.Tree, Key); Node : constant Node_Access := Key_Ops.Find (Container.Tree, Key);
begin begin
if Node = null then return (if Node = null then No_Element
return No_Element; else Cursor'(Container'Unrestricted_Access, Node));
end if;
return Cursor'(Container'Unrestricted_Access, Node);
end Find; end Find;
----------- -----------
...@@ -778,10 +773,8 @@ package body Ada.Containers.Ordered_Maps is ...@@ -778,10 +773,8 @@ package body Ada.Containers.Ordered_Maps is
begin begin
if L.Key < R.Key then if L.Key < R.Key then
return False; return False;
elsif R.Key < L.Key then elsif R.Key < L.Key then
return False; return False;
else else
return L.Element = R.Element; return L.Element = R.Element;
end if; end if;
......
...@@ -1555,11 +1555,8 @@ package body Ada.Containers.Ordered_Multisets is ...@@ -1555,11 +1555,8 @@ package body Ada.Containers.Ordered_Multisets is
Node : constant Node_Access := Node : constant Node_Access :=
Tree_Operations.Previous (Position.Node); Tree_Operations.Previous (Position.Node);
begin begin
if Node = null then return (if Node = null then No_Element
return No_Element; else Cursor'(Position.Container, Node));
end if;
return Cursor'(Position.Container, Node);
end; end;
end Previous; end Previous;
......
...@@ -523,7 +523,6 @@ package body Ada.Containers.Ordered_Sets is ...@@ -523,7 +523,6 @@ package body Ada.Containers.Ordered_Sets is
if Object.Container /= null then if Object.Container /= null then
declare declare
B : Natural renames Object.Container.all.Tree.Busy; B : Natural renames Object.Container.all.Tree.Busy;
begin begin
B := B - 1; B := B - 1;
end; end;
......
...@@ -1356,6 +1356,14 @@ package body Freeze is ...@@ -1356,6 +1356,14 @@ package body Freeze is
Bod : constant Node_Id := Next (After); Bod : constant Node_Id := Next (After);
begin begin
-- The presence of a body freezes all entities previously
-- declared in the current list of declarations, but this
-- does not apply if the body does not come from source.
-- A type invariant is transformed into a subprogram body
-- which is placed at the end of the private part of the
-- current package, but this body does not freeze incomplete
-- types that may be declared in this private part.
if (Nkind_In (Bod, N_Subprogram_Body, if (Nkind_In (Bod, N_Subprogram_Body,
N_Entry_Body, N_Entry_Body,
N_Package_Body, N_Package_Body,
...@@ -1363,7 +1371,7 @@ package body Freeze is ...@@ -1363,7 +1371,7 @@ package body Freeze is
N_Task_Body) N_Task_Body)
or else Nkind (Bod) in N_Body_Stub) or else Nkind (Bod) in N_Body_Stub)
and then and then
List_Containing (After) = List_Containing (Parent (E)) List_Containing (After) = List_Containing (Parent (E))
and then Comes_From_Source (Bod) and then Comes_From_Source (Bod)
then then
Error_Msg_Sloc := Sloc (Next (After)); Error_Msg_Sloc := Sloc (Next (After));
......
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