-- comparable, and we can figure out the difference between them.
declare
- Diff : aliased Uint;
+ Diff : Uint;
begin
case
Compile_Time_Compare
- (Lo_Bound, Hi_Bound, Diff'Access, Assume_Valid => False)
+ (Lo_Bound, Hi_Bound, Diff, Assume_Valid => False)
is
when EQ =>
Fold_Uint (N, Uint_1, Static);
------------------
when Attribute_Range_Length => Range_Length : declare
- Diff : aliased Uint;
+ Diff : Uint;
begin
Set_Bounds;
-- comparable, and we can figure out the difference between them.
case Compile_Time_Compare
- (Lo_Bound, Hi_Bound, Diff'Access, Assume_Valid => False)
+ (Lo_Bound, Hi_Bound, Diff, Assume_Valid => False)
is
when EQ =>
Fold_Uint (N, Uint_1, Static);
(L, R : Node_Id;
Assume_Valid : Boolean) return Compare_Result
is
- Discard : aliased Uint;
+ Discard : Uint;
begin
- return Compile_Time_Compare (L, R, Discard'Access, Assume_Valid);
+ return Compile_Time_Compare (L, R, Discard, Assume_Valid);
end Compile_Time_Compare;
function Compile_Time_Compare
(L, R : Node_Id;
- Diff : access Uint;
+ Diff : out Uint;
Assume_Valid : Boolean;
Rec : Boolean := False) return Compare_Result
is
Ltyp : Entity_Id := Etype (L);
Rtyp : Entity_Id := Etype (R);
- Discard : aliased Uint;
+ Discard : Uint;
procedure Compare_Decompose
(N : Node_Id;
-- Start of processing for Compile_Time_Compare
begin
- Diff.all := No_Uint;
+ Diff := 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
Hi : constant Uint := Expr_Value (R);
begin
if Lo < Hi then
- Diff.all := Hi - Lo;
+ Diff := Hi - Lo;
return LT;
elsif Lo = Hi then
return EQ;
else
- Diff.all := Lo - Hi;
+ Diff := Lo - Hi;
return GT;
end if;
end;
and then not Is_Modular_Integer_Type (Rtyp)
then
if Loffs < Roffs then
- Diff.all := Roffs - Loffs;
+ Diff := Roffs - Loffs;
return LT;
else
- Diff.all := Loffs - Roffs;
+ Diff := Loffs - Roffs;
return GT;
end if;
end if;
if LHi < RLo then
if Single and Assume_Valid then
- Diff.all := RLo - LLo;
+ Diff := RLo - LLo;
end if;
return LT;
elsif RHi < LLo then
if Single and Assume_Valid then
- Diff.all := LLo - RLo;
+ Diff := LLo - RLo;
end if;
return GT;
if not Is_Generic_Type (Rtyp) then
case Compile_Time_Compare (L, Type_Low_Bound (Rtyp),
- Discard'Access,
+ Discard,
Assume_Valid, Rec => True)
is
when LT => return LT;
end case;
case Compile_Time_Compare (L, Type_High_Bound (Rtyp),
- Discard'Access,
+ Discard,
Assume_Valid, Rec => True)
is
when GT => return GT;
if not Is_Generic_Type (Ltyp) then
case Compile_Time_Compare (Type_Low_Bound (Ltyp), R,
- Discard'Access,
+ Discard,
Assume_Valid, Rec => True)
is
when GT => return GT;
end case;
case Compile_Time_Compare (Type_High_Bound (Ltyp), R,
- Discard'Access,
+ Discard,
Assume_Valid, Rec => True)
is
when LT => return LT;
function Compile_Time_Compare
(L, R : Node_Id;
- Diff : access Uint;
+ Diff : out 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.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.
+ -- 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.
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