From 352620476c902cea186f10e68a97880edb255743 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 23 Jun 2009 11:32:31 +0200 Subject: [PATCH] [multiple changes] 2009-06-23 Pascal Obry * s-strhas.adb, s-strhas.ads: Minor reformatting. 2009-06-23 Ed Schonberg * sem_ch10.adb (Install_Limited_Withed_Unit): a null procedure does not indicate that the enclosing unit needs a body. From-SVN: r148836 --- gcc/ada/ChangeLog | 9 +++++++++ gcc/ada/s-strhas.adb | 18 +++++++++++++----- gcc/ada/s-strhas.ads | 8 ++++---- gcc/ada/sem_ch10.adb | 16 +++++++++++++--- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index baef841cf7b..fb43672d50a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2009-06-23 Pascal Obry + + * s-strhas.adb, s-strhas.ads: Minor reformatting. + +2009-06-23 Ed Schonberg + + * sem_ch10.adb (Install_Limited_Withed_Unit): a null procedure does + not indicate that the enclosing unit needs a body. + 2009-06-23 Emmanuel Briot * prj-conf.ads, prj-conf.adb: New files part of the project manager. diff --git a/gcc/ada/s-strhas.adb b/gcc/ada/s-strhas.adb index 2e3a730d27b..158fb077e7b 100644 --- a/gcc/ada/s-strhas.adb +++ b/gcc/ada/s-strhas.adb @@ -35,18 +35,26 @@ package body System.String_Hash is -- the algorithm used in GNU Awk and the ndbm substitute SDBM by -- Ozan Yigit. - function Hash (Key : Key_Type) return Hash_Type - is + ---------- + -- Hash -- + ---------- + + function Hash (Key : Key_Type) return Hash_Type is + function Shift_Left - (Value : Hash_Type; Amount : Natural) return Hash_Type; + (Value : Hash_Type; + Amount : Natural) return Hash_Type; pragma Import (Intrinsic, Shift_Left); - H : Hash_Type := 0; + H : Hash_Type; + begin + H := 0; for J in Key'Range loop H := Char_Type'Pos (Key (J)) - + Shift_Left (H, 6) + Shift_Left (H, 16) - H; + + Shift_Left (H, 6) + Shift_Left (H, 16) - H; end loop; + return H; end Hash; diff --git a/gcc/ada/s-strhas.ads b/gcc/ada/s-strhas.ads index bd7c7431c15..7e721558732 100644 --- a/gcc/ada/s-strhas.ads +++ b/gcc/ada/s-strhas.ads @@ -42,16 +42,16 @@ package System.String_Hash is generic type Char_Type is (<>); - -- The character type composing the key string type. + -- The character type composing the key string type type Key_Type is array (Positive range <>) of Char_Type; - -- The string type to use as a hash key. + -- The string type to use as a hash key type Hash_Type is mod <>; - -- The type to be returned as a hash value. + -- The type to be returned as a hash value function Hash (Key : Key_Type) return Hash_Type; pragma Inline (Hash); - -- Compute a hash value for a key. + -- Compute a hash value for a key end System.String_Hash; diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 8882713a852..04f6f99536c 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -4140,19 +4140,29 @@ package body Sem_Ch10 is end; -- Finally, check whether there are subprograms that still - -- require a body. + -- require a body, i.e. are not renamings or null. if not Is_Empty_Elmt_List (Subp_List) then declare Subp_Id : Elmt_Id; + Spec : Node_Id; begin Subp_Id := First_Elmt (Subp_List); + Spec := Parent (Node (Subp_Id)); while Present (Subp_Id) loop - if Nkind (Parent (Parent (Node (Subp_Id)))) - /= N_Subprogram_Renaming_Declaration + if Nkind (Parent (Spec)) + = N_Subprogram_Renaming_Declaration then + null; + + elsif Nkind (Spec) = N_Procedure_Specification + and then Null_Present (Spec) + then + null; + + else Set_Body_Required (Library_Unit (N)); return; end if; -- 2.30.2