From: Piotr Trojanek Date: Thu, 5 Nov 2020 20:09:28 +0000 (+0100) Subject: [Ada] Restore access type instead of mode out parameter X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0f2ee7a7f99f35ef59e125ff046df84a711ebfb;p=gcc.git [Ada] Restore access type instead of mode out parameter gcc/ada/ * sem_eval.ads (Compile_Time_Compare): Restore parameter Diff to be of an access type. * sem_eval.adb (Compile_Time_Compare): Adapt body and callers. * sem_attr.adb (Eval_Attribute): Adapt callers. --- diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index e42c5032b2e..18b4eeab27e 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -9138,12 +9138,12 @@ package body Sem_Attr is -- comparable, and we can figure out the difference between them. declare - Diff : Uint; + Diff : aliased Uint; begin case Compile_Time_Compare - (Lo_Bound, Hi_Bound, Diff, Assume_Valid => False) + (Lo_Bound, Hi_Bound, Diff'Access, Assume_Valid => False) is when EQ => Fold_Uint (N, Uint_1, Static); @@ -9631,7 +9631,7 @@ package body Sem_Attr is ------------------ when Attribute_Range_Length => Range_Length : declare - Diff : Uint; + Diff : aliased Uint; begin Set_Bounds; @@ -9651,7 +9651,7 @@ package body Sem_Attr is -- comparable, and we can figure out the difference between them. case Compile_Time_Compare - (Lo_Bound, Hi_Bound, Diff, Assume_Valid => False) + (Lo_Bound, Hi_Bound, Diff'Access, Assume_Valid => False) is when EQ => Fold_Uint (N, Uint_1, Static); diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 6e75a91275f..c54c49ac9a8 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -864,21 +864,21 @@ package body Sem_Eval is (L, R : Node_Id; Assume_Valid : Boolean) return Compare_Result is - Discard : Uint; + Discard : aliased Uint; begin - return Compile_Time_Compare (L, R, Discard, Assume_Valid); + return Compile_Time_Compare (L, R, Discard'Access, Assume_Valid); end Compile_Time_Compare; function Compile_Time_Compare (L, R : Node_Id; - Diff : out Uint; + Diff : access Uint; Assume_Valid : Boolean; Rec : Boolean := False) return Compare_Result is Ltyp : Entity_Id := Etype (L); Rtyp : Entity_Id := Etype (R); - Discard : Uint; + Discard : aliased Uint; procedure Compare_Decompose (N : Node_Id; @@ -1197,7 +1197,7 @@ package body Sem_Eval is -- Start of processing for Compile_Time_Compare begin - Diff := No_Uint; + Diff.all := No_Uint; -- In preanalysis mode, always return Unknown unless the expression -- is static. It is too early to be thinking we know the result of a @@ -1354,12 +1354,12 @@ package body Sem_Eval is Hi : constant Uint := Expr_Value (R); begin if Lo < Hi then - Diff := Hi - Lo; + Diff.all := Hi - Lo; return LT; elsif Lo = Hi then return EQ; else - Diff := Lo - Hi; + Diff.all := Lo - Hi; return GT; end if; end; @@ -1463,10 +1463,10 @@ package body Sem_Eval is and then not Is_Modular_Integer_Type (Rtyp) then if Loffs < Roffs then - Diff := Roffs - Loffs; + Diff.all := Roffs - Loffs; return LT; else - Diff := Loffs - Roffs; + Diff.all := Loffs - Roffs; return GT; end if; end if; @@ -1492,14 +1492,14 @@ package body Sem_Eval is if LHi < RLo then if Single and Assume_Valid then - Diff := RLo - LLo; + Diff.all := RLo - LLo; end if; return LT; elsif RHi < LLo then if Single and Assume_Valid then - Diff := LLo - RLo; + Diff.all := LLo - RLo; end if; return GT; @@ -1562,7 +1562,7 @@ package body Sem_Eval is if not Is_Generic_Type (Rtyp) then case Compile_Time_Compare (L, Type_Low_Bound (Rtyp), - Discard, + Discard'Access, Assume_Valid, Rec => True) is when LT => return LT; @@ -1572,7 +1572,7 @@ package body Sem_Eval is end case; case Compile_Time_Compare (L, Type_High_Bound (Rtyp), - Discard, + Discard'Access, Assume_Valid, Rec => True) is when GT => return GT; @@ -1584,7 +1584,7 @@ package body Sem_Eval is if not Is_Generic_Type (Ltyp) then case Compile_Time_Compare (Type_Low_Bound (Ltyp), R, - Discard, + Discard'Access, Assume_Valid, Rec => True) is when GT => return GT; @@ -1594,7 +1594,7 @@ package body Sem_Eval is end case; case Compile_Time_Compare (Type_High_Bound (Ltyp), R, - Discard, + Discard'Access, Assume_Valid, Rec => True) is when LT => return LT; diff --git a/gcc/ada/sem_eval.ads b/gcc/ada/sem_eval.ads index d0c6cf81d6a..76e4bdf5d65 100644 --- a/gcc/ada/sem_eval.ads +++ b/gcc/ada/sem_eval.ads @@ -194,16 +194,16 @@ package Sem_Eval is function Compile_Time_Compare (L, R : Node_Id; - Diff : out Uint; + Diff : access Uint; Assume_Valid : Boolean; Rec : Boolean := False) return Compare_Result; -- This version of Compile_Time_Compare returns extra information if the -- result is GT or LT. In these cases, if the magnitude of the difference -- can be determined at compile time, this (positive) magnitude is returned - -- in Diff. If the magnitude of the difference cannot be determined then - -- Diff contains No_Uint on return. Rec is a parameter that is set True for - -- a recursive call from within Compile_Time_Compare to avoid some infinite - -- recursion cases. It should never be set by a client. + -- in Diff.all. If the magnitude of the difference cannot be determined + -- then Diff.all contains No_Uint on return. Rec is a parameter that is set + -- True for a recursive call from within Compile_Time_Compare to avoid some + -- infinite recursion cases. It should never be set by a client. function Compile_Time_Known_Bounds (T : Entity_Id) return Boolean; -- If T is an array whose index bounds are all known at compile time, then