summaryrefslogtreecommitdiff
path: root/gcc/ada/a-cihase.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-cihase.adb')
-rw-r--r--gcc/ada/a-cihase.adb28
1 files changed, 18 insertions, 10 deletions
diff --git a/gcc/ada/a-cihase.adb b/gcc/ada/a-cihase.adb
index 034cfce67ec..9d96b6c6452 100644
--- a/gcc/ada/a-cihase.adb
+++ b/gcc/ada/a-cihase.adb
@@ -186,10 +186,12 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
procedure Assign (Node : Node_Access; Item : Element_Type) is
X : Element_Access := Node.Element;
- pragma Unsuppress (Accessibility_Check);
-- The element allocator may need an accessibility check in the case the
-- actual type is class-wide or has access discriminants (RM 4.8(10.1)
-- and AI12-0035).
+
+ pragma Unsuppress (Accessibility_Check);
+
begin
Node.Element := new Element_Type'(Item);
Free_Element (X);
@@ -199,10 +201,10 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
begin
if Target'Address = Source'Address then
return;
+ else
+ Target.Clear;
+ Target.Union (Source);
end if;
-
- Target.Clear;
- Target.Union (Source);
end Assign;
--------------
@@ -813,10 +815,12 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
X := Position.Node.Element;
declare
- pragma Unsuppress (Accessibility_Check);
-- The element allocator may need an accessibility check in the
-- case the actual type is class-wide or has access discriminants
-- (see RM 4.8(10.1) and AI12-0035).
+
+ pragma Unsuppress (Accessibility_Check);
+
begin
Position.Node.Element := new Element_Type'(New_Item);
end;
@@ -875,14 +879,18 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
--------------
function New_Node (Next : Node_Access) return Node_Access is
- pragma Unsuppress (Accessibility_Check);
+
-- The element allocator may need an accessibility check in the case
-- the actual type is class-wide or has access discriminants (see
-- RM 4.8(10.1) and AI12-0035).
+ pragma Unsuppress (Accessibility_Check);
+
Element : Element_Access := new Element_Type'(New_Item);
+
begin
return new Node_Type'(Element, Next);
+
exception
when others =>
Free_Element (Element);
@@ -898,9 +906,7 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
Local_Insert (HT, New_Item, Node, Inserted);
- if Inserted
- and then HT.Length > HT_Ops.Capacity (HT)
- then
+ if Inserted and then HT.Length > HT_Ops.Capacity (HT) then
HT_Ops.Reserve_Capacity (HT, HT.Length);
end if;
end Insert;
@@ -1335,10 +1341,12 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
X := Node.Element;
declare
- pragma Unsuppress (Accessibility_Check);
-- The element allocator may need an accessibility check in the case
-- the actual type is class-wide or has access discriminants (see
-- RM 4.8(10.1) and AI12-0035).
+
+ pragma Unsuppress (Accessibility_Check);
+
begin
Node.Element := new Element_Type'(New_Item);
end;