summaryrefslogtreecommitdiff
path: root/gcc/ada/g-pehage.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-13 10:23:29 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-13 10:23:29 +0000
commit453c24fb4dcaabaa2ef129d61468fc1e8733dcaa (patch)
tree740c5aba3c0949b0af4ce8a5af9213a4c4837b5f /gcc/ada/g-pehage.adb
parent7b17e51b9ad5916b8df45cf5bedaf1ba81aaa0a2 (diff)
downloadgcc-453c24fb4dcaabaa2ef129d61468fc1e8733dcaa.tar.gz
2007-12-06 Bob Duff <duff@adacore.com>
* clean.adb (Usage): Add line for -aP (Check_Version_And_Help): Change Check_Version_And_Help to be generic, with a parameter "procedure Usage", instead of passing a pointer to a procedure. This is to eliminate trampolines (since the Usage procedure is often nested in a main procedure, and it would be inconvenient to unnest it). * g-comlin.adb (For_Each_Simple_Switch): Change For_Each_Simple_Switch to be generic, with a parameter "procedure Callback (...)", instead of passing a pointer to a procedure. This is to eliminate trampolines (since the Callback procedure is usually nested). * gnatfind.adb, switch.adb, switch.ads, gnatlink.adb, gnatls.adb, gnatname.adb, gnatxref.adb, gnatchop.adb, gprep.adb, gnatbind.adb (Check_Version_And_Help): Change Check_Version_And_Help to be generic. * g-pehage.adb (Compute_Edges_And_Vertices, Build_Identical_Key_Sets): Use the generic Heap_Sort_G instead of Heap_Sort_A. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130824 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-pehage.adb')
-rw-r--r--gcc/ada/g-pehage.adb22
1 files changed, 10 insertions, 12 deletions
diff --git a/gcc/ada/g-pehage.adb b/gcc/ada/g-pehage.adb
index c6420920053..6d9670f69f8 100644
--- a/gcc/ada/g-pehage.adb
+++ b/gcc/ada/g-pehage.adb
@@ -34,7 +34,7 @@
with Ada.Exceptions; use Ada.Exceptions;
with Ada.IO_Exceptions; use Ada.IO_Exceptions;
-with GNAT.Heap_Sort_A; use GNAT.Heap_Sort_A;
+with GNAT.Heap_Sort_G;
with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Table;
@@ -696,7 +696,7 @@ package body GNAT.Perfect_Hash_Generators is
procedure Move (From : Natural; To : Natural);
function Lt (L, R : Natural) return Boolean;
- -- Subprograms needed for GNAT.Heap_Sort_A
+ -- Subprograms needed for GNAT.Heap_Sort_G
--------
-- Lt --
@@ -718,11 +718,13 @@ package body GNAT.Perfect_Hash_Generators is
Set_Edges (To, Get_Edges (From));
end Move;
+ package Sorting is new GNAT.Heap_Sort_G (Move, Lt);
+
-- Start of processing for Compute_Edges_And_Vertices
begin
-- We store edges from 1 to 2 * NK and leave zero alone in order to use
- -- GNAT.Heap_Sort_A.
+ -- GNAT.Heap_Sort_G.
Edges_Len := 2 * NK + 1;
@@ -780,10 +782,7 @@ package body GNAT.Perfect_Hash_Generators is
-- is sorted by X and then Y. To compute the neighbor list, sort the
-- edges.
- Sort
- (Edges_Len - 1,
- Move'Unrestricted_Access,
- Lt'Unrestricted_Access);
+ Sorting.Sort (Edges_Len - 1);
if Verbose then
Put_Edges (Output, "Sorted Edge Table");
@@ -1976,7 +1975,7 @@ package body GNAT.Perfect_Hash_Generators is
function Lt (L, R : Natural) return Boolean;
procedure Move (From : Natural; To : Natural);
- -- Subprograms needed by GNAT.Heap_Sort_A
+ -- Subprograms needed by GNAT.Heap_Sort_G
--------
-- Lt --
@@ -2024,6 +2023,8 @@ package body GNAT.Perfect_Hash_Generators is
WT.Table (Target) := WT.Table (Source);
end Move;
+ package Sorting is new GNAT.Heap_Sort_G (Move, Lt);
+
-- Start of processing for Build_Identical_Key_Sets
begin
@@ -2041,10 +2042,7 @@ package body GNAT.Perfect_Hash_Generators is
else
Offset := Reduced (S (J).First) - 1;
- Sort
- (S (J).Last - S (J).First + 1,
- Move'Unrestricted_Access,
- Lt'Unrestricted_Access);
+ Sorting.Sort (S (J).Last - S (J).First + 1);
F := S (J).First;
L := F;