aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-cihase.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-11-23 14:32:44 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-11-23 14:32:44 +0100
commitb38c20a636ec4e92cdabecbfa487b742829ebe93 (patch)
treee4cb2a009b5464c65617b77964d5b5b7ae9ba450 /gcc/ada/a-cihase.adb
parent24fee494c559f58afeb921b96a755be8d952b1d3 (diff)
downloadgcc-b38c20a636ec4e92cdabecbfa487b742829ebe93.zip
gcc-b38c20a636ec4e92cdabecbfa487b742829ebe93.tar.gz
gcc-b38c20a636ec4e92cdabecbfa487b742829ebe93.tar.bz2
[multiple changes]
2011-11-23 Matthew Heaney <heaney@adacore.com> * a-coorse.ads, a-ciorse.ads, a-cborse.ads (Set_Iterator_Interfaces): Renamed from Ordered_Set_Iterator_Interfaces. * a-coorse.adb, a-ciorse.adb, a-cborse.adb (Iterator): Declared Iterator type as limited (First, Last): Cursor return value depends on iterator node value (Iterate): Use start position as iterator node value (Next, Previous): Forward to corresponding cursor-based operation. * a-cohase.ads, a-cohase.adb: Implemented forward iterator. * a-cihase.adb, a-cbhase.adb (Iterator): Removed unnecessary node component (First, Next): Forward call to corresponding cursor-based operation (Iterate): Representation of iterator no longer has node component 2011-11-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_intr.adb (Expand_Unc_Deallocation): Ensure that the dereference has a proper type before the side effect removal mechanism kicks in. * sem_ch3.adb (Analyze_Subtype_Declaration): Handle a rare case where the base type of the subtype is a private itype created to act as the partial view of a constrained record type. This scenario manifests with equivalent class-wide types for records with unknown discriminants. 2011-11-23 Jerome Guitton <guitton@adacore.com> * s-osprim-vxworks.adb (Clock): Use Clock_RT_Ada. 2011-11-23 Thomas Quinot <quinot@adacore.com> * s-oscons-tmplt.c: Fix unbalanced preprocessor directives Minor reformatting/reorganization. From-SVN: r181666
Diffstat (limited to 'gcc/ada/a-cihase.adb')
-rw-r--r--gcc/ada/a-cihase.adb26
1 files changed, 14 insertions, 12 deletions
diff --git a/gcc/ada/a-cihase.adb b/gcc/ada/a-cihase.adb
index e29a204..22c5890 100644
--- a/gcc/ada/a-cihase.adb
+++ b/gcc/ada/a-cihase.adb
@@ -41,10 +41,10 @@ with System; use type System.Address;
package body Ada.Containers.Indefinite_Hashed_Sets is
- type Iterator is new Set_Iterator_Interfaces.Forward_Iterator with record
- Container : Set_Access;
- Position : Cursor;
- end record;
+ type Iterator is limited new
+ Set_Iterator_Interfaces.Forward_Iterator with record
+ Container : Set_Access;
+ end record;
overriding function First (Object : Iterator) return Cursor;
@@ -649,10 +649,8 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
end First;
function First (Object : Iterator) return Cursor is
- Node : constant Node_Access := HT_Ops.First (Object.Container.HT);
begin
- return (if Node = null then No_Element
- else Cursor'(Object.Container, Node));
+ return Object.Container.First;
end First;
----------
@@ -1011,7 +1009,7 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
function Iterate (Container : Set)
return Set_Iterator_Interfaces.Forward_Iterator'Class is
begin
- return Iterator'(Container'Unrestricted_Access, First (Container));
+ return Iterator'(Container => Container'Unrestricted_Access);
end Iterate;
------------
@@ -1072,12 +1070,16 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
Position : Cursor) return Cursor
is
begin
+ if Position.Container = null then
+ return No_Element;
+ end if;
+
if Position.Container /= Object.Container then
raise Program_Error with
- "Position cursor designates wrong set";
+ "Position cursor of Next designates wrong set";
end if;
- return (if Position.Node = null then No_Element else Next (Position));
+ return Next (Position);
end Next;
-------------
@@ -1895,7 +1897,7 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
Key_Keys.Delete_Key_Sans_Free (Container.HT, Key, X);
if X = null then
- raise Constraint_Error with "key not in map";
+ raise Constraint_Error with "key not in map"; -- ??? "set"
end if;
Free (X);
@@ -1913,7 +1915,7 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
begin
if Node = null then
- raise Constraint_Error with "key not in map";
+ raise Constraint_Error with "key not in map"; -- ??? "set"
end if;
return Node.Element.all;