diff options
author | Yannick Moy <moy@adacore.com> | 2024-04-11 12:30:32 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-10 11:04:00 +0200 |
commit | 8a27ded7923a7a6d1cd310b93358481803c3f4ba (patch) | |
tree | d26df2fd232d2710d893db09b874919542a0d8b2 /gcc | |
parent | c5aa1535e1328af279b8145fef1ae6fdc91b75fa (diff) | |
download | gcc-8a27ded7923a7a6d1cd310b93358481803c3f4ba.zip gcc-8a27ded7923a7a6d1cd310b93358481803c3f4ba.tar.gz gcc-8a27ded7923a7a6d1cd310b93358481803c3f4ba.tar.bz2 |
ada: Remove streaming facilities from generics for formal containers
The dependency on Ada.Streams is problematic for light runtimes.
As these streaming facilities are in fact not used in formal containers,
remove the corresponding dead code.
gcc/ada/
* libgnat/a-chtgfo.adb (Generic_Read, Generic_Write): Remove.
* libgnat/a-chtgfo.ads: Same. Remove dependency on Ada.Streams.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/libgnat/a-chtgfo.adb | 68 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-chtgfo.ads | 24 |
2 files changed, 0 insertions, 92 deletions
diff --git a/gcc/ada/libgnat/a-chtgfo.adb b/gcc/ada/libgnat/a-chtgfo.adb index c3fff33..df7b554 100644 --- a/gcc/ada/libgnat/a-chtgfo.adb +++ b/gcc/ada/libgnat/a-chtgfo.adb @@ -359,74 +359,6 @@ package body Ada.Containers.Hash_Tables.Generic_Formal_Operations is end loop; end Generic_Iteration; - ------------------ - -- Generic_Read -- - ------------------ - - procedure Generic_Read - (Stream : not null access Root_Stream_Type'Class; - HT : out Hash_Table_Type) - is - N : Count_Type'Base; - - begin - Clear (HT); - - Count_Type'Base'Read (Stream, N); - - if Checks and then N < 0 then - raise Program_Error with "stream appears to be corrupt"; - end if; - - if N = 0 then - return; - end if; - - if Checks and then N > HT.Capacity then - raise Capacity_Error with "too many elements in stream"; - end if; - - for J in 1 .. N loop - declare - Node : constant Count_Type := New_Node (Stream); - Indx : constant Hash_Type := Index (HT, HT.Nodes (Node)); - B : Count_Type renames HT.Buckets (Indx); - begin - Set_Next (HT.Nodes (Node), Next => B); - B := Node; - end; - - HT.Length := HT.Length + 1; - end loop; - end Generic_Read; - - ------------------- - -- Generic_Write -- - ------------------- - - procedure Generic_Write - (Stream : not null access Root_Stream_Type'Class; - HT : Hash_Table_Type) - is - procedure Write (Node : Count_Type); - pragma Inline (Write); - - procedure Write is new Generic_Iteration (Write); - - ----------- - -- Write -- - ----------- - - procedure Write (Node : Count_Type) is - begin - Write (Stream, HT.Nodes (Node)); - end Write; - - begin - Count_Type'Base'Write (Stream, HT.Length); - Write (HT); - end Generic_Write; - ----------- -- Index -- ----------- diff --git a/gcc/ada/libgnat/a-chtgfo.ads b/gcc/ada/libgnat/a-chtgfo.ads index 76633d8..f4471be 100644 --- a/gcc/ada/libgnat/a-chtgfo.ads +++ b/gcc/ada/libgnat/a-chtgfo.ads @@ -30,8 +30,6 @@ -- Hash_Table_Type is used to implement hashed containers. This package -- declares hash-table operations that do not depend on keys. -with Ada.Streams; - generic with package HT_Types is new Generic_Formal_Hash_Table_Types (<>); @@ -113,26 +111,4 @@ package Ada.Containers.Hash_Tables.Generic_Formal_Operations is procedure Generic_Iteration (HT : Hash_Table_Type); -- Calls Process for each node in hash table HT - generic - use Ada.Streams; - with procedure Write - (Stream : not null access Root_Stream_Type'Class; - Node : Node_Type); - procedure Generic_Write - (Stream : not null access Root_Stream_Type'Class; - HT : Hash_Table_Type); - -- Used to implement the streaming attribute for hashed containers. It - -- calls Write for each node to write its value into Stream. - - generic - use Ada.Streams; - with function New_Node (Stream : not null access Root_Stream_Type'Class) - return Count_Type; - procedure Generic_Read - (Stream : not null access Root_Stream_Type'Class; - HT : out Hash_Table_Type); - -- Used to implement the streaming attribute for hashed containers. It - -- first clears hash table HT, then populates the hash table by calling - -- New_Node for each item in Stream. - end Ada.Containers.Hash_Tables.Generic_Formal_Operations; |