summaryrefslogtreecommitdiff
path: root/gcc/ada/a-ciorma.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-ciorma.adb')
-rw-r--r--gcc/ada/a-ciorma.adb23
1 files changed, 17 insertions, 6 deletions
diff --git a/gcc/ada/a-ciorma.adb b/gcc/ada/a-ciorma.adb
index 15e0835db44..472c912d27b 100644
--- a/gcc/ada/a-ciorma.adb
+++ b/gcc/ada/a-ciorma.adb
@@ -813,12 +813,15 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
Position.Node.Key := new Key_Type'(Key);
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);
+
exception
when others =>
Free_Key (K);
@@ -857,10 +860,12 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
function New_Node return Node_Access is
Node : Node_Access := new Node_Type;
- 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.Key := new Key_Type'(Key);
Node.Element := new Element_Type'(New_Item);
@@ -869,9 +874,10 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
exception
when others =>
- -- On exception, deallocate key and elem
+ -- On exception, deallocate key and elem. Note that free
+ -- deallocates both the key and the elem.
- Free (Node); -- Note that Free deallocates key and elem too
+ Free (Node);
raise;
end New_Node;
@@ -1502,12 +1508,15 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
Node.Key := new Key_Type'(Key);
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);
+
exception
when others =>
Free_Key (K);
@@ -1556,10 +1565,12 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
declare
X : Element_Access := Position.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 (see
-- RM 4.8(10.1) and AI12-0035).
+
+ pragma Unsuppress (Accessibility_Check);
+
begin
Position.Node.Element := new Element_Type'(New_Item);
Free_Element (X);