aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-comutr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-11-23 14:51:23 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-11-23 14:51:23 +0100
commitef9924527b2a36fbadd27ca9f67f32368aeee6f2 (patch)
tree267a728ee3a7d34623bc37b747312a45db885308 /gcc/ada/a-comutr.adb
parent595a055f982c5b9c00b37cf289090e2627267d0b (diff)
downloadgcc-ef9924527b2a36fbadd27ca9f67f32368aeee6f2.zip
gcc-ef9924527b2a36fbadd27ca9f67f32368aeee6f2.tar.gz
gcc-ef9924527b2a36fbadd27ca9f67f32368aeee6f2.tar.bz2
[multiple changes]
2011-11-23 Ed Schonberg <schonberg@adacore.com> * freeze.adb (Freeze_All_Ent): An incomplete type is not frozen by a subprogram body that does not come from source. 2011-11-23 Pascal Obry <obry@adacore.com> * s-oscons-tmplt.c: Add PTY_Library constant. It contains the library for pseudo terminal support. * g-exptty.ads: Add pseudo-terminal library into a Linker_Options pragma. 2011-11-23 Ed Schonberg <schonberg@adacore.com> * sem_ch9.adb: No check on entry family index if generic. 2011-11-23 Thomas Quinot <quinot@adacore.com> * sem_ch9.adb, s-taprop.ads, s-taprop-hpux-dce.adb, s-taprop-irix.adb, s-taprop-posix.adb, s-taprop-rtx.adb, s-taprop-solaris.adb, s-taprop-tru64.adb, s-taprop-vxworks.adb: Move dependency on System.OS_Constants from shared spec of System.Tasking.Primitive_Operations to the specific body variants that really require this dependency. 2011-11-23 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Analyze_Subprogram_Renaming_Declaration): If the declaration has aspects, analyze them so they can be properly rejected. 2011-11-23 Hristian Kirtchev <kirtchev@adacore.com> * a-comutr.adb, a-coorma.adb, a-coorse.adb, a-convec.adb, a-cihase.adb, a-cimutr.adb, a-coinve.adb, a-ciorma.adb, a-ciorse.adb, a-cobove.adb, a-cohama.adb, a-cihama.adb, a-cidlli.adb, a-cdlili.adb, a-cbhama.adb, a-cbhase.adb, a-cbmutr.adb, a-cborma.adb, a-cborse.adb, a-cbdlli.adb: Add with and use clause for Ada.Finalization. Type Iterator and Child_Iterator are now derived from Limited_Controlled. (Finalize): New routine. (Iterate): Add a renaming of counter Busy and increment it. Update the return aggregate. (Iterate_Children): Add a renaming of counter Busy and increment it. Update the return aggregate. (Iterate_Subtree): Add a renaming of counter Busy and increment it. Update the return aggregate. * a-cdlili.ads, a-cidlli.ads: Type List_Access is now a general access type. * a-cihama.ads: Type Map_Access is now a general access type. * a-comutr.ads, a-cimutr.ads: Use type Natural for the two locks associated with the tree. * a-cohama.ads: Type Map_Access is now a general access type. * a-coinve.ads, a-convec.ads: Type Vector_Access is now a general access type. * exp_ch5.adb (Expand_Iterator_Loop): Do not create a block to wrap the loop as this is done at an earlier step, during analysis. The declarations of the iterator and the cursor use the usual Insert_Action mechanism when added into the tree. * sem_ch5.adb (Analyze_Loop_Statement): Remove local constant Loop_Statement and replace all respective uses by N. Add local constant Loc. Preanalyze the loop iterator to discover whether it is a container iterator and if it is, wrap the loop in a block. This ensures that any controlled temporaries produced by the iteration scheme share the same lifetime of the loop. (Is_Container_Iterator): New routine. (Is_Wrapped_In_Block): New routine. (Pre_Analyze_Range): Move spec and body to the library level. 2011-11-23 Sergey Rybin <rybin@adacore.com frybin> * gnat_ugn.texi, vms_data.ads: Add documentation for new gnatpp option that controls casing of type and subtype names. 2011-11-23 Yannick Moy <moy@adacore.com> * sem_ch3.adb: Minor addition of comments. 2011-11-23 Thomas Quinot <quinot@adacore.com> * prj-part.adb (Extension_Withs): New global variable, contains the head of the list of WITH clauses from the EXTENDS ALL projects for which virtual packages are being created. (Look_For_Virtual_Projects_For): When recursing through an EXTENDS ALL, add the WITH clauses of the extending project to Extension_Withs. When adding a project to the Virtual_Hash, record the associated Extension_Withs list. (Create_Virtual_Extending_Project): Add a copy of the appropriate Extension_Withs to the virtual project. 2011-11-23 Thomas Quinot <quinot@adacore.com> * mlib-tgt-specific-vxworks.adb: Minor reformatting. 2011-11-23 Thomas Quinot <quinot@adacore.com> * Make-generated.in (Sdefault.Target_Name): Set to $(target_noncanonical) instead of $(target) for consistency. From-SVN: r181668
Diffstat (limited to 'gcc/ada/a-comutr.adb')
-rw-r--r--gcc/ada/a-comutr.adb97
1 files changed, 76 insertions, 21 deletions
diff --git a/gcc/ada/a-comutr.adb b/gcc/ada/a-comutr.adb
index 86be79f..e78aacc 100644
--- a/gcc/ada/a-comutr.adb
+++ b/gcc/ada/a-comutr.adb
@@ -29,28 +29,34 @@
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
-with System; use type System.Address;
+with System; use type System.Address;
package body Ada.Containers.Multiway_Trees is
- type Iterator is new Tree_Iterator_Interfaces.Forward_Iterator with
+ type Iterator is new Limited_Controlled and
+ Tree_Iterator_Interfaces.Forward_Iterator with
record
Container : Tree_Access;
Position : Cursor;
From_Root : Boolean;
end record;
- type Child_Iterator is new Tree_Iterator_Interfaces.Reversible_Iterator with
+ type Child_Iterator is new Limited_Controlled and
+ Tree_Iterator_Interfaces.Reversible_Iterator with
record
Container : Tree_Access;
Position : Cursor;
end record;
+ overriding procedure Finalize (Object : in out Iterator);
+
overriding function First (Object : Iterator) return Cursor;
overriding function Next
(Object : Iterator;
Position : Cursor) return Cursor;
+ overriding procedure Finalize (Object : in out Child_Iterator);
+
overriding function First (Object : Child_Iterator) return Cursor;
overriding function Next
(Object : Child_Iterator;
@@ -898,6 +904,34 @@ package body Ada.Containers.Multiway_Trees is
return Equal_Children (Left_Subtree, Right_Subtree);
end Equal_Subtree;
+ --------------
+ -- Finalize --
+ --------------
+
+ procedure Finalize (Object : in out Iterator) is
+ begin
+ if Object.Container /= null then
+ declare
+ B : Natural renames Object.Container.all.Busy;
+
+ begin
+ B := B - 1;
+ end;
+ end if;
+ end Finalize;
+
+ procedure Finalize (Object : in out Child_Iterator) is
+ begin
+ if Object.Container /= null then
+ declare
+ B : Natural renames Object.Container.all.Busy;
+
+ begin
+ B := B - 1;
+ end;
+ end if;
+ end Finalize;
+
----------
-- Find --
----------
@@ -1342,8 +1376,7 @@ package body Ada.Containers.Multiway_Trees is
(Container : Tree;
Process : not null access procedure (Position : Cursor))
is
- T : Tree renames Container'Unrestricted_Access.all;
- B : Integer renames T.Busy;
+ B : Natural renames Container'Unrestricted_Access.all.Busy;
begin
B := B + 1;
@@ -1364,13 +1397,19 @@ package body Ada.Containers.Multiway_Trees is
function Iterate (Container : Tree)
return Tree_Iterator_Interfaces.Forward_Iterator'Class
is
- Root_Cursor : constant Cursor :=
- (Container'Unrestricted_Access, Root_Node (Container));
+ B : Natural renames Container'Unrestricted_Access.all.Busy;
+ RC : constant Cursor :=
+ (Container'Unrestricted_Access, Root_Node (Container));
+
begin
- return
- Iterator'(Container'Unrestricted_Access,
- First_Child (Root_Cursor),
- From_Root => True);
+ return It : constant Iterator :=
+ Iterator'(Limited_Controlled with
+ Container => Container'Unrestricted_Access,
+ Position => First_Child (RC),
+ From_Root => True)
+ do
+ B := B + 1;
+ end return;
end Iterate;
----------------------
@@ -1387,7 +1426,7 @@ package body Ada.Containers.Multiway_Trees is
end if;
declare
- B : Integer renames Parent.Container.Busy;
+ B : Natural renames Parent.Container.Busy;
C : Tree_Node_Access;
begin
@@ -1434,9 +1473,16 @@ package body Ada.Containers.Multiway_Trees is
Parent : Cursor)
return Tree_Iterator_Interfaces.Reversible_Iterator'Class
is
- pragma Unreferenced (Container);
+ B : Natural renames Container'Unrestricted_Access.all.Busy;
+
begin
- return Child_Iterator'(Parent.Container, Parent);
+ return It : constant Child_Iterator :=
+ Child_Iterator'(Limited_Controlled with
+ Container => Parent.Container,
+ Position => Parent)
+ do
+ B := B + 1;
+ end return;
end Iterate_Children;
---------------------
@@ -1447,8 +1493,17 @@ package body Ada.Containers.Multiway_Trees is
(Position : Cursor)
return Tree_Iterator_Interfaces.Forward_Iterator'Class
is
+ B : Natural renames Position.Container'Unrestricted_Access.all.Busy;
+
begin
- return Iterator'(Position.Container, Position, From_Root => False);
+ return It : constant Iterator :=
+ Iterator'(Limited_Controlled with
+ Container => Position.Container,
+ Position => Position,
+ From_Root => False)
+ do
+ B := B + 1;
+ end return;
end Iterate_Subtree;
procedure Iterate_Subtree
@@ -1461,7 +1516,7 @@ package body Ada.Containers.Multiway_Trees is
end if;
declare
- B : Integer renames Position.Container.Busy;
+ B : Natural renames Position.Container.Busy;
begin
B := B + 1;
@@ -1807,8 +1862,8 @@ package body Ada.Containers.Multiway_Trees is
declare
T : Tree renames Position.Container.all'Unrestricted_Access.all;
- B : Integer renames T.Busy;
- L : Integer renames T.Lock;
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
B := B + 1;
@@ -2060,7 +2115,7 @@ package body Ada.Containers.Multiway_Trees is
end if;
declare
- B : Integer renames Parent.Container.Busy;
+ B : Natural renames Parent.Container.Busy;
C : Tree_Node_Access;
begin
@@ -2578,8 +2633,8 @@ package body Ada.Containers.Multiway_Trees is
declare
T : Tree renames Position.Container.all'Unrestricted_Access.all;
- B : Integer renames T.Busy;
- L : Integer renames T.Lock;
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
B := B + 1;