From 3aacb9ed526c68e49424ec4dc4833de8353d2a7c Mon Sep 17 00:00:00 2001 From: Raphael Amiard Date: Thu, 19 Sep 2019 08:13:06 +0000 Subject: [PATCH] [Ada] Add comments wrt. deallocation of bounded sets/maps 2019-09-19 Raphael Amiard gcc/ada/ * libgnat/a-cbhama.ads, libgnat/a-cbhase.ads, libgnat/a-chtgop.ads (Clear): Refine comments From-SVN: r275936 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/libgnat/a-cbhama.ads | 3 ++- gcc/ada/libgnat/a-cbhase.ads | 3 ++- gcc/ada/libgnat/a-chtgop.ads | 5 +++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5ff5f16875a..f9a8bfe7583 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-09-19 Raphael Amiard + + * libgnat/a-cbhama.ads, libgnat/a-cbhase.ads, + libgnat/a-chtgop.ads (Clear): Refine comments + 2019-09-19 Eric Botcazou * sem_ch12.adb (Restore_Private_Views): Comment out new code diff --git a/gcc/ada/libgnat/a-cbhama.ads b/gcc/ada/libgnat/a-cbhama.ads index b4d1105bbc4..0238548a942 100644 --- a/gcc/ada/libgnat/a-cbhama.ads +++ b/gcc/ada/libgnat/a-cbhama.ads @@ -107,7 +107,8 @@ package Ada.Containers.Bounded_Hashed_Maps is -- Equivalent to Length (Container) = 0 procedure Clear (Container : in out Map); - -- Removes all of the items from the map + -- Removes all of the items from the map. This will deallocate all memory + -- associated with this map. function Key (Position : Cursor) return Key_Type; -- Returns the key of the node designated by the cursor diff --git a/gcc/ada/libgnat/a-cbhase.ads b/gcc/ada/libgnat/a-cbhase.ads index 8f1b886b6b7..cb9150bdfae 100644 --- a/gcc/ada/libgnat/a-cbhase.ads +++ b/gcc/ada/libgnat/a-cbhase.ads @@ -120,7 +120,8 @@ package Ada.Containers.Bounded_Hashed_Sets is -- Equivalent to Length (Container) = 0 procedure Clear (Container : in out Set); - -- Removes all of the items from the set + -- Removes all of the items from the set. This will deallocate all memory + -- associated with this set. function Element (Position : Cursor) return Element_Type; -- Returns the element of the node designated by the cursor diff --git a/gcc/ada/libgnat/a-chtgop.ads b/gcc/ada/libgnat/a-chtgop.ads index 3bb42fe65a9..6ebb9e5c3b6 100644 --- a/gcc/ada/libgnat/a-chtgop.ads +++ b/gcc/ada/libgnat/a-chtgop.ads @@ -107,8 +107,9 @@ package Ada.Containers.Hash_Tables.Generic_Operations is procedure Clear (HT : in out Hash_Table_Type); -- Deallocates each node in hash table HT. (Note that it only deallocates - -- the nodes, not the buckets array.) Program_Error is raised if the hash - -- table is busy. + -- the nodes, not the buckets array. Also note that for bounded containers, + -- the buckets array is not dynamically allocated). Program_Error is raised + -- if the hash table is busy. procedure Move (Target, Source : in out Hash_Table_Type); -- Moves (not copies) the buckets array and nodes from Source to -- 2.30.2