From bfdc95943e46532617c70eed00f5dff5a2238dcd Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Fri, 29 Jan 2021 19:34:39 +0100 Subject: [PATCH] [Ada] Remove End_Interp_List from the overloaded resolution API gcc/ada/ * sem_ch4.adb (Analyze_Call): Remove call to End_Interp_List. (Process_Overloaded_Indexed_Component): Remove call to End_Interp_List. * sem_util.adb (Insert_Explicit_Dereference): Remove call to End_Interp_List. * sem_type.ads (End_Interp_List): Remove. * sem_type.adb (Add_Entry): The guard against duplicate entries is now checked before other conditions, so that EXIT statements do not bypass this guard. (End_Interp_List): Remove. --- gcc/ada/sem_ch4.adb | 4 ---- gcc/ada/sem_type.adb | 26 ++++++++------------------ gcc/ada/sem_type.ads | 3 --- gcc/ada/sem_util.adb | 2 -- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 15b4999..f89db02 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -1461,8 +1461,6 @@ package body Sem_Ch4 is else Remove_Abstract_Operations (N); end if; - - End_Interp_List; end if; -- Check the accessibility level for actuals for explicitly aliased @@ -2790,8 +2788,6 @@ package body Sem_Ch4 is Error_Msg_N ("no legal interpretation for indexed component", N); Set_Is_Overloaded (N, False); end if; - - End_Interp_List; end Process_Overloaded_Indexed_Component; -- Start of processing for Analyze_Indexed_Component_Form diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index b22c904..8ffdda3 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -239,6 +239,13 @@ package body Sem_Type is Get_First_Interp (N, I, It); while Present (It.Nam) loop + -- Avoid making duplicate entries in overloads + + if Name = It.Nam + and then Base_Type (It.Typ) = Base_Type (T) + then + return; + -- A user-defined subprogram hides another declared at an outer -- level, or one that is use-visible. So return if previous -- definition hides new one (which is either in an outer @@ -248,7 +255,7 @@ package body Sem_Type is -- If this is a universal operation, retain the operator in case -- preference rule applies. - if (((Ekind (Name) = E_Function or else Ekind (Name) = E_Procedure) + elsif ((Ekind (Name) in E_Function | E_Procedure and then Ekind (Name) = Ekind (It.Nam)) or else (Ekind (Name) = E_Operator and then Ekind (It.Nam) = E_Function)) @@ -292,13 +299,6 @@ package body Sem_Type is return; end if; - -- Avoid making duplicate entries in overloads - - elsif Name = It.Nam - and then Base_Type (It.Typ) = Base_Type (T) - then - return; - -- Otherwise keep going else @@ -2227,16 +2227,6 @@ package body Sem_Type is end if; end Disambiguate; - --------------------- - -- End_Interp_List -- - --------------------- - - procedure End_Interp_List is - begin - All_Interp.Table (All_Interp.Last) := No_Interp; - All_Interp.Increment_Last; - end End_Interp_List; - ------------------------- -- Entity_Matches_Spec -- ------------------------- diff --git a/gcc/ada/sem_type.ads b/gcc/ada/sem_type.ads index b0cb7c7..89fd617 100644 --- a/gcc/ada/sem_type.ads +++ b/gcc/ada/sem_type.ads @@ -130,9 +130,6 @@ package Sem_Type is -- always Boolean, and we use Opnd_Type, which is a candidate type for one -- of the operands of N, to check visibility. - procedure End_Interp_List; - -- End the list of interpretations of current node - procedure Get_First_Interp (N : Node_Id; I : out Interp_Index; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 7d919a0..4e6fef5 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -15044,8 +15044,6 @@ package body Sem_Util is Get_Next_Interp (I, It); end loop; - End_Interp_List; - else -- Prefix is unambiguous: mark the original prefix (which might -- Come_From_Source) as a reference, since the new (relocated) one -- 2.7.4